cancel
Showing results for 
Search instead for 
Did you mean: 

HANA Spatial: How to get Points from Polygon?

UweFetzer_se38
Active Contributor
0 Kudos

In HANA you define a polygon by setting multiple points, for example

NEW ST_Polygon('Polygon ((-5 -5, 5 -5, 0 5, -5 -5), (-2 -2, -2 0, 2 0, 2 -2, -2 -2))')

Is it somehow possible to get the points of an already existing polygon? I can't find a reverse functionion in the documentation (and I don't want to misuse the ST_AsGeoJSON function for this).

Accepted Solutions (1)

Accepted Solutions (1)

mkemeter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Uwe,

you can achieve this by iterating over the exterior and interior rings of the polygon.

You can retrieve the exterior and interior rings of the polygon by using ST_ExteriorRing and ST_InteriorRingN. The number of points per ring can be queried with ST_NumPoints and the specific point can be retrieved with ST_PointN.

The documentation of the respective functions can be found here:
https://help.sap.com/viewer/cbbbfc20871e4559abfd45a78ad58c02/2.0.04/en-US/7a13f280787c10148dc893063d...

Another 'hack' would be to play with the WKT of the polygon - but this is somewhat similar to your GeoJSON example.

Regards,
Mathias

UweFetzer_se38
Active Contributor
0 Kudos

Hello Mathias,

ST_AsWKT() is an interesting idea. I Think I'll try this approach. But first I have to solve my other issue, because currently the result of the call is truncated (due to an HANA Client error?) in ABAP (see "HANA Client library: Large result string truncated in ABAP")

Answers (0)