on 06-08-2021 3:42 PM
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
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;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.