I have a shapefile of the Washington metro area, but along much of the route multiple lines run parallel to each other (see picture 1) and I need to collapse them into a single line.

I've tried creating a buffer and dissolving the result, which visually achieves what I'm looking for but ultimately I need a single shapefile line representing the center line that I can then run the qchainage process on but so far haven't been able to achieve that.

Does anyone have a way to achieve this in QGIS?

I believe I'm essentially trying to replicate the 'Collapse Dual Lines To Centerline' functionality in ArcGIS.

Input shapefile:

enter image description here

Dissolve Buffer result: enter image description here

  • Why don't you simply only use the middle line and delete the rest? Yeah, I am lazy, I know... – Erik Jun 29 '18 at 14:47
  • Possible duplicate of Merging close lines? – Erik Jun 29 '18 at 14:49
  • Hi Erik, this is just a small snapshot of a much large file, some lines extend further than others so it wouldn't really be feasible to do it manually!! (i wish it was) I did see the merging close lines thread, but wasn't able to follow second part of the answer (below), so clarification required please! "import the layer into a postgis database and create the middle line using ST_ApproximateMedialAxis() function: SELECT ST_ApproximateMedialAxis(geom) AS geom INTO road_centre_line FROM road_buffer" – Jsangster Jun 29 '18 at 14:53
  • If you're working with QGIS 3.0 and geopackages, that should not be necessary, since geopackages are supposed to be editable by SQL-commands. – Erik Jun 29 '18 at 15:26
  • Erik, could you elaborate on how to apply that function? Novice user here. – Jsangster Jun 29 '18 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.