Using QGIS Valmiera (MapInfo and other software is also available)

Is there a way to convert a polyline with multiple segments into a single line? I.e. by taking the first point and the last point of the polyline and simply connecting the two.

Furthermore, is this possible to be done under a condition that say the polyline is straight enough to be considered a single line. For example if polyline is within a certain distance of the line connecting the start and the end point.

The context is I'm importing into a hydraulics software package with a pipe limit and polylines are disaggregated in this software and as a result count for thousands of pipes rather than hundreds despite being largely straight.


3 Answers 3


Simplify didn't do it for me. What did what I wanted (a polyline of one segment) was: Vector->Geoprocessing Tools->Dissolve.


You can do this with grass plugin of qgis. Import your file in grass and use v.clean.snap to connect lines (you have to set threshold of course). After that save the file as a shape and use Qgis->Dissolve. With this command you obtain a single geometry of all your lines. After that, use "multipart to singlepart" to obtain again single geometry where lines don't touch each others.

  • Why not simply use grass.osgeo.org/grass64/manuals/v.build.polylines.html ?
    – markusN
    Sep 16, 2014 at 7:07
  • If I read the question right also sort of routing is wanted - click on start and end points and merge all the segments along the route.
    – user30184
    Sep 16, 2014 at 7:12
  • @markusN Just because he didn't use the tag GRASS in the post. So I tried to use qgis as much as possible.
    – Sergio
    Sep 16, 2014 at 7:45
  • @markusN Could you turn your comment into a new answer? I think it is closer to what is asked for.
    – AndreJ
    Sep 16, 2014 at 9:14
  • I would do but unfortunately v.build.polyline is not registered in "Processing" of QGIS. It is done by writing a simple ASCII control file, someone may file a feature request at hub.qgis.org/projects/sextante
    – markusN
    Sep 18, 2014 at 3:08

In QGIS I found a very comparable solution in the Vector -> Geometry Tools -> Simplify Geometries toolbox in the menu bar.

This effectively and greatly reduced the number of nodes in the polyline without compromising the overall shape of the vectors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.