# Creating centroid on curved surface in QGIS

I am using QGIS 3.16.13 to build a map in which I have 98 adjacent polygons that represent areas of ocean around the coastline of an island. I want to have a centroid inside of each polygon, even those that are curved around peninsulas because it does not make sense to use a centroid that appears to be on land as a location marker for marine data.

As per this thread QGIS Point on Surface, I understand how to force a point to be on the surface of a polygon, but is there a way to force the point to be centered on the polygon, as well as being forced to be on the surface of the polygon?

I am getting the same result as the example given at the end of that thread, with the point seemingly placed at random within the polygon, rather than being in the center of the polygon, while also being on the surface of it.

So, I have polygons representing areas of sea where counting is occurring. The counting areas follow the coastline as it curves around peninsulas. Using "Point on Surface" or the "Pole of Inaccessibility", I get the black circles in this example, but what I want is to have a point roughly where I've drawn in by hand yellow circles: In my mind, what I've drawn in is close to the center of the polygons. When I have QGIS calculate centroids, the centroid of area #64 shown here is placed in the middle of the peninsula.

I know that I can move these points by hand, but I am wondering if there is a way to do it automatically.

I don't know a tool to have directly what you want but I propose here a workflow to have the following result : Names like this refers to QGIS processing algorithms

1. Compute the Minimum Bounding Geometry, choose as Geometry : Minimum Oriented Rectangle : here the result in grey
2. (skipped step as the centroid is computed in the expression in the step 3 : Compute Centroids of Minumum Oriented Rectangles : here the result in red)
3. Compute the line representing the width of the rectangle passing through its centroid with Geometry by expression and the Geometry expression : `extend(shortest_line(centroid(\$geometry), boundary(\$geometry)), "width" / 2, "width" / 2)` : here the black line
4. Clip the black line with your original polygon : here the blue line
5. Compute Centroids of the blue line to get a point, located on the original polygon, visually centered : here the little cross in the square
• Wow, that was fast. Thank you. I'm quitting for the day, but I will try this tomorrow. Nov 10, 2021 at 18:09
• Great idea! Steps 3 to 5 could also be integrated in one single expression with the functions `intersection` and `centroid`. Nov 12, 2021 at 12:07