QGIS Polygon – Creating Center Line of Odd Shaped Polygon

geometric-networkpolygonqgiswaterways

I'm trying to calculate a center line of an odd shaped polygon. When I've used the Polygon Tool 'Centerlines' with the setting 'All' is doesn't create center lines for all of the polygon, only part of it. This doesn't seem like it should be a terribly difficult thing to do. Are there any other ways.

The picture is of a radius of 15km from a reintroduction site at the centre. The mustard polygon (network of rivers/water) and the green line is the center line given by the 'Centerlines' tool. This green line should be within all of the mustard coloured polygon.

I've also tried the 'Centerline in Polygon Gaps' and 'Skeleton/Medial Axis' tool in the HCMGIS plugin which freezes before they can produce an output.

enter image description here

Best Answer

EDIT/UPDATE: I updated my QGIS to v3.22.4. With this I could use the GRASS algorithm v.voronoi.skeleton. Much simpler! (See here for similar question - Calculating river width)

ORIGINAL SOLUTION:

  1. Create a new column in the attributes table of the polygon with the value to '1' in it.
  2. Convert the polygon into a raster layer using the "Rasterize (Vector to Raster)" tool, burning in the value of '1' from the new column.
  3. I then used the "Centerlines (Skeletonize)" raster tool (from the Geometric Attributes plugin) using the lees method to get a center line.

I found this the best method and that for such a large polygon, my computer handled it well and processing did not take too long (maybe about 30mins). It did not require any splitting up of the polygon or too many complicated steps.