[Qgis-user] "Dissolve" a line layer?

Richard Greenwood richard.greenwood at gmail.com
Fri Jun 8 05:20:17 PDT 2012


On Fri, Jun 8, 2012 at 12:30 AM, magerlin <MAP at ramboll.dk> wrote:
> I've got a road network which is broken down to a lot of very short sections.
> Theese I would like to join by the road name to just get one feature per
> road name.
>
> If it had been a polygon layer I could have used the Vector - Geoprocessing
> - Dissolve tool, but it is only for polygons.
>
> I am aware that I can do it manually either 2 sections at a time by the
> "Join two lines" plugin or more sections at a time by using the "Merge
> selected features" button in the Advanced Digitizing toolbar. But there are
> far to many sections to do this by hand....
>
> Any suggestions?
>
> -----
> Regards Morten

I am new to qGIS and I do not know of a 'native' way to accomplish
your goal, but if you use PostGIS then ST_LineMerge() would do the
trick. It is an aggregate function, so something like:

INSERT INTO road(wkb_geometry, name )
SELECT
    ST_LineMerge(st_collect(wkb_geometry)) as wkb_geometry, name
     from road_segments group by name;

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the Qgis-user mailing list