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.
Best Answer
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
extend(shortest_line(centroid($geometry), boundary($geometry)), "width" / 2, "width" / 2)
: here the black line