-
-
Notifications
You must be signed in to change notification settings - Fork 479
Description
In some scenarios it is not possible to create a polygon (when e.g. the way has less than 4 points). But I still want to obtain the centroid.
In the documentation it is stated, that this only works with polygons/multipolygons. I gave it a shot and anyways, it is possible to obtain a centroid from linestrings like object:as_linestring():centroid(). This works in all cases, when it is not possible to create a polygon (when polygon:is_null()), with the single exception when a line(multiline has only one node (like https://www.openstreetmap.org/relation/7360610). PostGis is working in this scenario select ST_Centroid(ST_MakePoint(1, 1)).
I tried to convert the geometry into a single point via object:as_point() but the call is not possible outside node processing.