cancel
Showing results for 
Search instead for 
Did you mean: 

Function ST_Centroid() does not support geometries of type ST_Point

0 Kudos

Hi Experts,

I am currently working on creating custom hierarchy to drill down from Country -> City on SAC geo map using HANA live. I am referring following blogs to create custom hierarchy:

HANA Live Custom Regions.pdf (sap.com)

SAC: Geo-spatial custom map hierarchy | SAP Blogs

While executing the procedure, I am facing below error :

exception 1600600: Function ST_Centroid() does not support geometries of type ST_Point at "st_centroid" function

Kindly provide your valuable inputs on how this error can be fixed.

Please note that I am populating data to "Shape" field using function "ST_GeomFromText('POINT(' || "LONG" || ' ' || "LAT" ||')', 4326).ST_Transform(3857)" not through ESRI shape files.

Regards,

Shruti

Accepted Solutions (1)

Accepted Solutions (1)

mfath
Advisor
Advisor
0 Kudos

Hej Shruti,

I understand that you are following a script which is a little more complex that I could understand at first glance, but I see that centroids are generated in the data column. The logic for this calculation could be enhance to check for the geometry type and if ST_Point then simply take the point as centroid. The below code would be able to handle points and polygons. Other geometry types would need to be added if neccessary.

Regards, Markus

CREATE COLUMN TABLE DAT( ID BIGINT, SHAPE ST_GEOMETRY(3857), CENTROID ST_GEOMETRY(3857) );

INSERT INTO DAT (ID, SHAPE) VALUES(1, ST_GEOMFROMTEXT('POINT (49 6)', 4326).ST_TRANSFORM(3857));

INSERT INTO DAT (ID, SHAPE) VALUES(2, ST_GEOMFROMTEXT('POLYGON ((49 6, 49 7, 48 7, 48 6, 49 6))', 4326).ST_TRANSFORM(3857));

UPDATE DAT SET CENTROID = CASE WHEN SHAPE.ST_GEOMETRYTYPE() = 'ST_Point' THEN SHAPE ELSE SHAPE.ST_CENTROID() END;

0 Kudos

Hi Markus,

Thanks for your valuable input. It seems like I do not have shape data (only have point data) due to which error is coming up. Do we need shape files to get shape data and is it possible to get shape data for all countries/cities in one zip file as it looks like we can get shape data country wise only.

Regards,

Shruti

Answers (0)