3

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

2
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Feb 7 at 13:38

1 Answer 1

4

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.

3
  • Could you please provide details (or a link to docs) for "Centerlines (Skeletonize)" raster tool? Is it from a plugin? The closest I see in the QGIS 3.22 processing toolbox is the SAGA Raster skeletonization. Perhaps it is the same with a name change.
    – Matt
    Feb 8 at 15:18
  • 1
    It is part of the Geometric Attributes plugin. This website is attached to the tool: github.com/BjornNyberg/Geometric-Attributes-Toolbox/wiki . (I am using QGIS 3.4.15-Madeira. Feb 8 at 15:23
  • 1
    ah, from the Geometric Attributes plugin. Much appreciated :) It would be good to add this to your answer to make it easy for others to find.
    – Matt
    Feb 8 at 15:25

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.