18

I was wondering if there is a way to create centre lines from polygons in QGIS? I have a polygon layer, but ideally need the centrelines as a separate file.

Example

  • I've just uploaded a picture of the polygons – Alan Carr Sep 20 '12 at 10:39
  • Where, in the example image, would the 'centrelines' fall? Could you update the image showing the desired lines in a different colour, perhaps? – Simbamangu Sep 20 '12 at 10:55
  • Just directly down the middle of all polygons. The final outcome we need would be to just find the length of the whole thing (assuming the polygons were lines) so it's not even essential to get centrelines. – Alan Carr Sep 20 '12 at 11:09
  • The HCMGIS plugin claims to create polygon centerlines as one of its Spatial Processing features. It didn't work very well for me, but it might be worth a try. – csk Jun 25 at 18:40
10

I've been working on implementing the model depicted in @RajGovind's answer to Creating Centrelines from Road Polygons/Casings? which is quite close to what @geogeek described in his answer here in this thread.

You can download the model from Github https://raw.githubusercontent.com/anitagraser/QGIS-Processing-tools/master/2.12/models/polygon_to_centerline.model

enter image description here

  • I've tried this model and it works, but I've been unable to figure out a simple way to keep the long center lines but removing the little side lines, since each of the side lines are composed of many smaller features, and the main centerline is also composed of many smaller line features. – Jan Sep 4 '16 at 19:41
  • @Jan please post this follow-up question in a new thread so more people will see it. – underdark Sep 5 '16 at 15:52
9

you can try This algorithme:

get vertices from the polygons(poly_vertex).
-make voronoi using (poly_vertex) as input the result could be called(poly_voronoi).
-get lines from (poly_voronoi) => (poly_voronoi_lines).
-get the originale polygon contour (polygon_lines).
-remove (poly_voronoi_lines) touching  (polygon_lines) the result is supposed to be the center lines , but you may need further clean up.

i don't know how it could be implemented on Qgis

i wish it could help

6

there is a good tool with the name of ET GeoWizards 10.2 for Esri products, but i dont know whether it is a good solution or not...

you can get some info from here

centerLines

beside this in grass you can check out r.thin function for basic use..

r.thin - Thins non-zero cells that denote linear features in a raster map layer.

rthin i hope it helps you...

3

just find the length of the whole thing

How exactly should be the result? An approximation is perimeter divided by 2.

To get a better result: You can manually measure some polygons.Then determine the difference between the measurement and perimeter divided by 2. Apply this correctionfactor to the whole datset.

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.