15

I have a problem in computing the centroids of certain polygons in QGIS (via the geometry tools): for certain polygons - with a strange and rather long shape - the centroids computed are off the polygon. Look, for instance, at the polygon marked in red, in the picture below:

enter image description here

Its centroid (pointed at by the blue arrow) is actually falling outside the polygon of interest. This occurs for a handful of (yet annoying) other polygons.

I am relatively new to QGIS, so I don't think whether this problem is due to the projection of the shapefile with the polygons (WGS 84). I tried anyway by re-projecting the map with WGS84/UTM Zone 31, which corresponds to Belgium (the country I'm looking at).

0

2 Answers 2

20

I think the standard QGIS polygon centroid tools calculate the centre of mass in order to determine the polygon's centroid. So this could lie outside the polygon itself (nothing to do with projection).

If you want the calculate the centroid in terms of its dimensions, you could use the realcentroid plugin instead which you can download from:

Plugins > Manage and Install Plugins...

Example:

An irregular polygon with the red circle calculated from the Polygon centroid tool from QGIS (and SAGA); the green circle calculated from the realcentroid plugin:

Result


There is also an online script which produces the same result as the plugin which you can download from:

Processing Toolbox > Scripts > Tools > Get scripts from on-line scripts collection

And find the Real centroid script.

0
12

Proessing QGIS Algorithms has "Point on Surface" too, under Vector geometry tools group. No need to use external plugins nor DBs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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