As far as I can tell, the option to "Create point on surface for each part" in the QGIS Centroid tool is not returning the correct geometry when activated in QGIS (version 3.8.1-Zanzibar/GDAL v 2.2.3 on Debian).
If we take a simple "banana-shaped" polygon:
and run the tool (Vector > Geometry Tools > Centroids
) as follows:
we get the following output, which represents the centroid, but not the point on surface.
We can cross check this output using ogr2ogr as follows:
ogr2ogr -dialect SQLite -sql "SELECT ST_Centroid(geometry) FROM tmp" tmp_centroid.shp tmp.shp
which returns the identical centroid:
whereas the following command forces the point on the surface of the polygon:
ogr2ogr -dialect SQLite -sql "SELECT ST_PointOnSurface(geometry) FROM tmp" tmp_ptonsurf.shp tmp.shp
is this a bug or is there something else that should be run/enabled in order to get the point on surface using the QGIS tool?
Best Answer
In QGIS 3.10 this option is not available using
Vector > Geometry Tools > Centroids
.However if you search for "Point on surface" in the Processing Toolbox (Ctrl+Shift+T) using QGIS 3.10 the functionality is there and works.