When I use Polygon centroid tool, points aren't always inside polygon, because some polygons have weird shape with holes inside them. I have big amount of polygons and I need to use this tool and I need all centroids to be inside polygons. Is there any way how can I make them to be inside polygons?

enter image description here


1 Answer 1


QGIS (at least in 3.0+) has a pole_of_inaccessibility function you can use.

Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface. This function uses the 'polylabel' algorithm (Vladimir Agafonkin, 2016), which is an iterative approach guaranteed to find the true pole of inaccessibility within a specified tolerance. More precise tolerances require more iterations and will take longer to calculate.

or if you just require a point that is within the polygon you could use the point_on_surface function:

Returns a point guaranteed to lie on the surface of a geometry.

This shows the differences - red is pole of inaccessibility, green is point on surface and blue is centroid.

enter image description here

  • Where's the pole of inaccessibility for a multipolygon feature that is two identical squares? I guess its the centre of either square, according to the vagaries of the algorithm....
    – Spacedman
    Jun 7, 2018 at 10:06
  • I think so - see blog.mapbox.com/… for more discussion
    – Ian Turton
    Jun 7, 2018 at 10:08

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.