[Qgis-us-user] Merging segments

karsten karsten at terragis.net
Mon Mar 22 11:17:15 PDT 2021


Hi Javier,
 
this should work with the vector tool 'disssolve' in QGIS. In the menu  
Vector > Geoprocessing tools > Dissolve
open the dialog windows and select the dissolve field. In your case this is
the NewSegmentID, specify a new layer to be created.
 
Note that in PostGIS there are other options involving SQL queries with
"group by" and "st_collect" or "st_union"
 
Cheers
Karsten
  _____  

From: Qgis-us-user [mailto:qgis-us-user-bounces at lists.osgeo.org] On Behalf
Of javier.valencia at vtgonline.com
Sent: Monday, March 22, 2021 09:25
To: qgis-us-user at lists.osgeo.org
Subject: [Qgis-us-user] Merging segments



I have an application where I need to merge segments.  Every segment has an
identifier OBJECTID which I believe is standard in QGIS. The initial merging
is done using an external database and I can generate result in this format:

 

OBJECTID   NewSegmentID

10001      Seg00001

10002      Seg00001

10003      Seg00001

10004      Seg00001

10005      Seg00002

10006      Seg00002

10007      Seg00003

10008      Seg00003

10009      Seg00003

10010      Seg00004

10011      Seg00004

10012      Seg00004

 

I can generate the table above in just about any database format,
spreadsheet or any flavor of text including CSV, or tab separated.

What I would like to do is merge individual segment into a longer segment
with the NewSegmentID (or a new OBJECTID as needed) as the identifier, so,
the new layer instead of having 12 segments has only 4 longer segments.

I believe there is a way to manually select a few segments and merge them
into one, but we have 35,000 segments that we need to merge into app, 8,000
longer segments so an automated solution is needed. The preferred output
format would be an ESRI shape file format.

Can I just link between the original layer and the new table and then store
the results in a new layer?

Is there a way to do this easily with existing QGIS tools?

Is there a snippet of code with instructions that I can use or easily modify
to do what I need?

Any help you can provide would be greatly appreciated.

 

Javier Valencia, PE

913-915-3137

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-us-user/attachments/20210322/8b61bb68/attachment.html>


More information about the Qgis-us-user mailing list