7

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:

enter image description here

and run the tool (Vector --> Geometry Tools --> Centroids) as follows:

enter image description here

we get the following output, which represents the centroid, but not the point on surface.

enter image description here

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:

enter image description here

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

enter image description here

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?

  • 1
    There's a seperate algorithm for "point on surface". Have you tried that one? – ndawson Dec 20 '19 at 10:26
  • thanks, yes, i saw the "point on surface" tool in the processing toolbox, which returns the correct point, but still wondering about the issue with the checkbox. – dmci Dec 20 '19 at 10:28
  • 2
    The description of the tool talk only about centroid and not point on surface, I think that the error is in the text next to the check box that should be "create centroid for each part" (try with a multipart polygon and see if the check box modify the output...) – J.R Dec 20 '19 at 10:40
  • thanks - agreed - this appears to have been updated in QGIS 3.10 as outlined below. – dmci Dec 20 '19 at 10:56
8

In version 3.10 this option is not available using Vector --> Geometry Tools --> Centroids.

enter image description here

However if you search for point on surface in the processing toolbox (using v.3.10) the functionality is there and works.

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.