Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member

Part of the SAP HANA Academy's What's New with SAP HANA SPS11 series, jamie.wiseman provides a tutorial video on using spatial functionality in HANA SQLScript. Specifically Jamie will detail how to use spatial data type ST_GEOMETRY and spatial methods to access and manipulate spatial data in HANA SQLScript. Note this feature is only applicable to SAP HANA SPS11 and it will not work for any prior iterations of SAP HANA.

Watch Jamie's quick tutorial below.

In SAP HANA SPS11 SQLScript now supports spatial data type ST_GEOMETRY and SQL spatial methods to access and manipulate spatial data. To demonstrate this Jamie is using a user defined function that uses spatial dimensions in a procedure. Then Jamie will call that procedure which contains a couple of ST_GEOMETRY inputs.

You must be logged into your SAP HANA system with a user who has the rights to create new functions and procedures. Please visit this GitHub page to access, for free, the script used in this tutorial.

Lines 1-9 of the script create a user defined function that has a pair of ST_GEOMETRY input parameters. Line 8 of the function uses the ST distance method to calculate the distance between the two inputs. The distance calculated is subjected to whatever SRID (spatial reference ID) is used.

Lines 11-27 create a procedure that not only references the user defined function, but also incorporates a pair of geometry type inputs. Also, two other spatial methods are used to create an additional display value. This display value consists of two different well-know text methods that will show spatial values in an easier to read text format. Currently at the time of this tutorial's creation only geometry spatial type values are allowed in SQLScript in SAP HANA SPS11.

If you were to uncomment line 13, which contains a point spatial type, then an error would be returned.

Lines 29-35 deal with the procedure call. The syntax for the two parameter inputs creates geometry spatial types. In Jamie's example both are points. The SRIDs of the two geometries are specified in the same input.

If you run all of the syntax at once you will get the results from the procedure's nested distance call and will also display the results from the two additional spatial methods.

For more tutorials videos on What's New with SAP HANA SPS11 please check out this playlist.

SAP HANA Academy - Over 1,300 free tutorials videos on SAP HANA, SAP Analytics and the SAP HANA Cloud Platform.

Follow us on Twitter @saphanaacademy and connect with us on LinkedIn to keep apprised of our latest free tutorials.

Labels in this area