QGIS – Finding Centroid Coordinates for Odd-Shaped Polygons

centroidsgeometrypolygonqgis

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).

I have not found an answer to a similar questions in past discussions; apologies if I accidentally overlooked it.

Best Answer

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.