[Qgis-user] Line dissolve

Nicolas Cadieux njacadieux.gitlab at gmail.com
Mon Aug 30 04:18:13 PDT 2021


Hi,
Thanks for the tip.  I will play with the aggregate function. 

 My goal is not to used the snap as I am trying to identify groups of connected lines in order to find the nodes that need to be snapped.   The goal of my models is to find almost every possible linear network error that would create a problem in a graph analysis (ex shortest path). 

 So far, I can hunt down and find disconnected nodes and line, disconnected crossing lines, duplicates, parallel edges, self connected line, overlapping or partial overlapping line segments…. I wanted to use the ‘does not touch’ spatial query.  That works well if a single geometry does not touch (first or last node touching) but if one end touches a second geometry, then the spatial selection fails.  By grouping or merging all connected lines together, then « touch » would work as the fist and last node of this new object would be identified as not touching any other object.  

Thanks everyone for your help and ideas it’s very useful. 

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 29 août 2021 à 16:41, Charles Dixon-Paver <charles at kartoza.com> a écrit :
> 
> 
> Hi Nicolas, I would urge you to try again as I was sure this would work and when I tested it I had no issues (using freshly digitized data). Maybe you need to run a snapping operation first?
> 
> One issue is that intersecting lines may break your ability to retrieve attributes with aggregates. For example, I ran the following on my Single parts geometries in the field calculator:
> 
> aggregate(layer:='lines',aggregate:='concatenate_unique',concatenator:=',',expression:= "idtext",filter:=within( $geometry, geometry(@parent)))
> 
> This initially had no issue getting all the matching line info, but as  soon as I added an intersecting line, the multipart to singlepart operation splits those lines at the intersections, which results in a mismatch in the retrieved attributes. Of course you could use an intersects() filter instead, but then you'll be getting the intersecting lines attributes concatenated as well...
> 
> Regards
> 
>> On Sun, 29 Aug 2021 at 17:18, Nicolas Cadieux <njacadieux.gitlab at gmail.com> wrote:
>> Hi,
>> 
>> Yes, Harrissou,
>> That does not work with lines unfortunately. I tried multiple times with different combinations.  It works with polygons when common borders need to be dissolved. I did see a merge function but did not find the line_merge plugin in  the repository. I figured it was QGIS2 and had been dropped.  Do you have any info of this?
>> 
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>> 
>>>> Le 29 août 2021 à 00:53, DelazJ <delazj at gmail.com> a écrit :
>>>> 
>>> Hi Nicolas,
>>> 
>>> What about using "Dissolve" and then "multiparts to singleparts"...
>>> There's also the line_merge function, if you want to go the expression route.
>>> 
>>> Regards,
>>> Harrissou
>>> 
>>> Le 29 août 2021 05:26:24 GMT+02:00, Nicolas Cadieux <njacadieux.gitlab at gmail.com> a écrit :
>>>> 
>>>> Hi,
>>>> 
>>>> Just to clarify, I have no attribute to dissolve the lines on… so If you have as easy way to create an attribute list of all connected lines groups, I would also appreciate it.  This is easy in strait python but I am making a model and trying to rely on existing algorithms.
>>>> Thanks!
>>>> 
>>>> Nicolas Cadieux
>>>> https://gitlab.com/njacadieux
>>>> 
>>>>>> Le 28 août 2021 à 20:21, Nicolas Cadieux <njacadieux.gitlab at gmail.com> a écrit :
>>>>>> 
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> Is there an easy way, in processing, to dissolve lines that are touching? Alternative, can I create a multilinestring with all the lines that are touching?  Seems this should be a basic tool to have in QGIS…
>>>>> 
>>>>> Nicolas Cadieux
>>>>> https://gitlab.com/njacadieux
>>> 
>>> -- 
>>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210830/33fc1a1c/attachment.html>


More information about the Qgis-user mailing list