Skip to Content
Technical Articles
Author's profile photo Geetha Madhuri Bobbili

Geospatial Data Processing in SAP HANA

Author: Geetha Madhuri Bobbili
LinkedIn Profile: https://www.linkedin.com/in/geetha-madhuri-bobbili-971268184/

Introduction:

 

To create a location enabled model in SAP Analytics Cloud from a live HANA calculation view, Location Data must be prepared through SAP HANA Studio.

The Latitude and Longitude can be converted in to Location Dimension using Spatial data types like Geometry (ST_Geometry) and POINT (ST_Point).

These data types are used to to store spatial information in SAP HANA.

Pre-requisites:

 

  1. The live HANA system must be at least on SPS11 on 112.07 or higher or SPS12 on 122.03 or higher.
  1. Your HANA system must be licensed for SAP HANA Spatial.
  2. The HANA system must be configured with a valid Spatial Reference Identifier (SRID) used by SAP Analytics Cloud.

Add Spatial Reference Identifier (SRID) 3857:

 

In the SAP HANA Studio console, run the following query:

 

CREATE SPATIAL REFERENCE SYSTEM “WGS 84 / Pseudo-Mercator” IDENTIFIED BY 3857 TYPE PLANAR

SNAP TO GRID 1e-4

TOLERANCE 1e-4

COORDINATE X BETWEEN -20037508.3427892447 AND 20037508.3427892447

COORDINATE Y BETWEEN -19929191.7668547928 AND 19929191.766854766

ORGANIZATION “EPSG” IDENTIFIED BY 3857

LINEAR UNIT OF MEASURE “metre”

ANGULAR UNIT OF MEASURE NULL

POLYGON FORMAT ‘EvenOdd’

STORAGE FORMAT ‘Internal’

DEFINITION ‘PROJCS[“Popular Visualisation CRS / Mercator”,

GEOGCS[“Popular Visualisation CRS”,DATUM[“Popular_Visualisation_Datum”,

SPHEROID[“Popular Visualisation Sphere”,6378137,0,AUTHORITY[“EPSG”,”7059″]],

TOWGS84[0,0,0,0,0,0,0],AUTHORITY[ “EPSG”,”6055″]],

PRIMEM[“Greenwich”,0,AUTHORITY[“EPSG”,”8901″]],UNIT[“degree”, 0.01745329251994328,

AUTHORITY[“EPSG”,”9122″]],AUTHORITY[“EPSG”,”4055″]],

UNIT[ “metre”,1,AUTHORITY[“EPSG”,”9001″]],PROJECTION[“Mercator_1SP”],PARAMETER[“cen tral_meridian”,0],

PARAMETER[“scale_factor”,1],PARAMETER[“false_easting”,0],PA RAMETER[“false_northing”,0],

AUTHORITY[“EPSG”,”3785″],AXIS[“X”,EAST],AXIS[“Y”, NORTH]]’

TRANSFORM DEFINITION ‘+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null
+wktext +no_defs’

Prepare Location Data from HANA Studio:

 

1. Right click on the table that contains latitude and longitude data and select Data Preview.

2. Select a column that will be the Primary key or unique Location identifier for each location. In this example, the Location Identifier is Country. Set Country as a key column in the calculation view.

3. Create a Geo Location table. This table should contain two columns:

  • Location Data identifier: ID column values from the Location Identifier (Ex: Country) column of your calculation view.
  • Spatial data column: containing spatial data (for example ST_GEOMETRY) generated from your latitude and longitude data with SRID 3857.

Once the table is created set the Location Data identifier column as a primary key.

 

Create a Calculation View:

 

4. Create a package (SAP_BOC_SPATIAL) to create your Calculation View containing location information. All the Geo-spatial HANA Views must be created in SAP_BOC_SPATIAL package.

5. Create a calculation view of type Dimension based on the Location Data. This view is referred to as Location Data view and should be created under Content > SAP_BOC_SPATIAL

6. Once the calculation view is created, drag the Location Data table to the Projection

 

7. Select the columns from the Location Data table in the Location Data view and set the Location Data Identifier column as a key column. In this example, it is Country_LD.

8. Select the Projection node, then double-click each column in the Details pane to make it display in the Output .

Select the Location Identifier column, then set the Key to True in the Properties pane.

9. Save and activate the calculation view.

10. Right click on the Calculation View and select Data Preview.

 

Conclusion:

 

Now we have created Location Dimension in HANA. In the next blog series, we will see how to consume these dimensions in SAP Analytics Cloud.

 

Thank you for taking the time to read my blog and I hope you find it beneficial. Please like, share and comment 🙂

Stay safe!

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jay Adnure
      Jay Adnure

      Hi Geetha,

      Thank you for the great blog. We are working on HANA cloud and want to know do we still need to create SAP_BOC_SPATIAL when using the CAP model building the app?

      Kr,

      Jay

      Author's profile photo Geetha Madhuri Bobbili
      Geetha Madhuri Bobbili
      Blog Post Author

      Hi Jay,

      Yes, SAP_BOC_SPATIAL package is required, if we want to install, configure, and use Spatial Data for SAP Analytics Cloud connecting to SAP HANA Server or SAP HANA Cloud Platform.

      Regards,

      Geetha.

      Author's profile photo eronita carol
      eronita carol

      Nice Post! Thanks for sharing such an amazing article, really informative, it helps me a lot.

      Author's profile photo Geetha Madhuri Bobbili
      Geetha Madhuri Bobbili
      Blog Post Author

      Thank you Eronita 🙂

      Author's profile photo gobinath palanisamy
      gobinath palanisamy

      Hi, I have created DB, now I would like to consume my maps into GEF Environment as business layers can you help me on this

      Author's profile photo Geetha Madhuri Bobbili
      Geetha Madhuri Bobbili
      Blog Post Author

      Hi Gobi,

      Can you please help me with the exact requirement.

      Regards,

      Geetha.

      Author's profile photo Liliana Cantero
      Liliana Cantero

      Hola Geetha,

      I am working on WebIde HANA cloud. I created a Geo Location table and a Calculation Views correctly. Then I created a Location Dimension in SAC  but when I use it in a Geo map this error appears:

      Caught exception : exception 1600301: Expected a coordinate, but found ‘,’ instead at position 9 of WKT POINT(-58,557012 -34,619977 )
      ID de correlación: 17119703-4624-4172-9057-089589752342

      I already checked and I have no duplicated records. And I also checked if there is a comma in the lat and long values ​​but there isn’t.

       

       

      Do you know why this error ocurrs?

      Thanks!

      Liliana Cantero