I have a shapefile with a few thousand lines, each is a street segment. I'd like to merge all features with the same 'streetName' attribute into a single attribute. I only really care about the name of the street and it's geometry.

What would be the query necessary to do such a thing?

I'm new to GIS in general and have run into a problem I can't figure out how to fix. Excuse my noobness. Thanks in advance.

  • possible duplicate of Batch Dissolve Polygons based on Attributes in QGIS or FWTools – Fezter Jul 25 '13 at 23:13
  • both fTools' dissolve and GRASS's v.dissolve work with polygons layers only, as far as I can tell. I need to dissolve lines. – Tercero A Jul 25 '13 at 23:45
  • I think v.build.polylines will do what you want. – Fezter Jul 25 '13 at 23:56
  • I'm going to leave this question open because the proposed duplicate seems to only address dissolving polygons not lines. If that question and one of its answers were edited to incorporate how to do it with lines then I would support closing this one as a duplicate. – PolyGeo Jul 26 '13 at 0:17
  • v.build.polylines does create polylines out of lines, the part I don't know how to do is make it only merge lines if they share the 'streetName' attribute. Being streets, the end nodes coincide with perpendicular streets' nodes too. – Tercero A Jul 26 '13 at 1:23

Vector->Geoprocessing Tools->Dissolve does work for lines and will return a multi-geometry where the lines do not have coincident vertices.

Yet another option is available from PostGIS or SpatiaLite using the ST_LineMerge function.


The answer which worked for me in QGIS 3.10 was:

Processing -> Toolbox -> Vector geometry -> Dissolve

Then, select which fields you want to use for merging by clicking the ... button next to Dissolve field(s) [optional].


Try Vector->Geometry Tools->Singleparts to multipart (QGIS 1.8.0). In Unique ID field select 'streetName' attribute of input shapefile. Result - multilinestring shapefile with unique 'streetName' attribute.

  • 1
    "Singleparts to multipart" did not work. I believe the problem is that my input shp geometry is already multilinestring. I've found this answer that uses ST_Intersects and GUnion. I can almost make this work but I keep getting [geom-type or SRID not allowed]. thank you anyway – Tercero A Jul 26 '13 at 17:53

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.