Skip to Content
0

CDS: Support for spatial - ST_POINT & ST_GEOMETRY

Jan 28 at 01:39 PM

85

avatar image

Hi,

From which release does SAP HANA CDS support spatial ST_POINT & ST_GEOMETRY?

I have tried with SAP HANA 2.0 Express, but get a "Property type ST_POINT/ST_GEOMETRY of property name <property> not allowed yet"

In document 'SAP HANA Platform 2.0 SPS 00 Document Version: 1.0 – 2016-11-30: SAP HANA Core Data Services (CDS) Reference' the following example is given:

Spatial Types
The following example shows how to use the spatial type ST_POINT in a CDS entity definition. In the example entity Person, each person has a home address and a business address, each of which is accessible via the corresponding associations. In the Address entity, the geo-spatial coordinates for each person are stored in element loc using the spatial type ST_POINT (*). 


Sample Code 
context SpatialData {  
entity Person {
   key id : Integer;
   name : String(100);
   homeAddress : Association[1] to Address;
   officeAddress : Association[1] to Address;
 };


 entity Address {
   key id : Integer;
   street_number : Integer;
   street_name : String(100);
   zip : String(10);
   city : String(100);
   loc : hana.ST_POINT(4326);
 };


 view CommuteDistance as select from Person {
   name,
   homeAddress.loc.ST_Distance(officeAddress.loc) as distance
 };
<br>

Best regards,

Henrik

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sergio Guerrero Jan 29 at 01:35 PM
0

geospatial type support has been available in CDS (hdbdd) since HANA 1 SP09 and geospatial funcitons since SP10 (answer from Thomas J)

https://blogs.sap.com/2014/02/25/experiences-with-sap-hana-geo-spatial-features-part-1/

is this the example you are following ?

https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.02/en-US/3c6980ab6ddb45f7bf15ef67a461258e.html

Share
10 |10000 characters needed characters left characters exceeded
Henrik Damhøj Andersen Feb 01 at 12:22 PM
0

Hi Sergio,

I was trying the example in document 'SAP HANA Platform 2.0 SPS 00 Document Version: 1.0 – 2016-11-30: SAP HANA Core Data Services (CDS) Reference' which is almost the same as the one in https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.02/en-US/3c6980ab6ddb45f7bf15ef67a461258e.html.

This what i'm doing;

  • create MTA project
  • created SAP HANA Database Module
  • create CDS Artifact (OData support)
  • create Java Module (Web Application with OData V4 Support)

I have now tried with that example (https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.02/en-US/3c6980ab6ddb45f7bf15ef67a461258e.html) slightly adjusted to my SAP HANA 2.0 Express;

@OData.publish : true
context Spatial {
    entity Person {
        key id            : Integer;
            name          : String(100);
            homeAddress   : association[1] to Address;
            officeAddress : association[1] to Address;
    };


    entity Address {
        key id            : Integer;
            street_number : Integer;
            street_name   : String(100);
            zip           : String(10);
            city          : String(100);
            loc           : hana.ST_POINT(4326);
    };


    view GeoView1 as
        select from Person
        {
            name,
            homeAddress.street_name || ', ' || homeAddress.city                                      as home,
            officeAddress.street_name || ', ' || officeAddress.city                                  as office,
            round(homeAddress.loc.st_distance(officeAddress.loc, 'meter') / 1000, 1)                 as distanceHomeToWork,
            round(homeAddress.loc.st_distance(new st_point(8.644072, 49.292910), 'meter') / 1000, 1) as distFromSAP03
        };
};

The problem (Property type ST_POINT of property name loc not allowed yet) is persistent. If i delete loc in entity Address and view GeoView1 it's working as expected.

My SAP HANA 2.0 Express is out of the box except for WebIDE which is patched to 6.

Do you have any clue to what the reason is? Is there some patches i'm missing?

Best regards,

Henrik


Share
10 |10000 characters needed characters left characters exceeded