[Qgis-user] Line dissolve

2021-08-28 Thread Nicolas Cadieux
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___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-28 Thread Nicolas Cadieux
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  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
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-28 Thread DelazJ
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 
 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  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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-29 Thread Nicolas Cadieux
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  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 
>  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  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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-29 Thread Charles Dixon-Paver
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 
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  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.git...@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  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@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-29 Thread Andrea Giudiceandrea

Nicolas Cadieux Sun, 29 Aug 2021 08:18:08 -0700


I did see a merge function but did not find the line_merge plugin in 
 the repository.


Hi Nicolas,
"line_merge" is not a plugin. It is a function  available in QGIS 
expression / field calculator:


14.3.13.53. line_merge
Returns a LineString or MultiLineString geometry, where any connected 
LineStrings from the input geometry have been merged into a single 
linestring. This function will return NULL if passed a geometry which is 
not a LineString/MultiLineString.

https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/functions_list.html#line-merge

Regards.

Andrea Giudiceandrea
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Nicolas Cadieux
Hi,

Thanks for the info.  There was also a line_merge (or merge line) plugin.   The 
problem with the function that you are indicating is that it take a single 
Multilinestring and create a simple linestring if the ends are connected.  What 
I am looking for is a way to select a file made of simple linestrings and to 
merged them into a single multilinestring if they share a node or share and 
object that shares a node.  So, for example, if you had two cities separated by 
a river (and there was no way to cross the river), all the roads would be 
merged in two objects, one for each city.

This post explains what I would like.  It offer a QGIS 2 script that could 
help. 
https://gis.stackexchange.com/questions/198317/join-merge-lines-that-touch-and-intersect-in-qgis

I will share a file with and example of what I am looking for.

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 29 août 2021 à 17:12, Andrea Giudiceandrea  a écrit 
> :
> 
> 
>> 
>> Nicolas Cadieux Sun, 29 Aug 2021 08:18:08 -0700
> 
>> I did see a merge function but did not find the line_merge plugin in  the 
>> repository.
> 
> Hi Nicolas,
> "line_merge" is not a plugin. It is a function  available in QGIS expression 
> / field calculator:
> 
> 14.3.13.53. line_merge
> Returns a LineString or MultiLineString geometry, where any connected 
> LineStrings from the input geometry have been merged into a single 
> linestring. This function will return NULL if passed a geometry which is not 
> a LineString/MultiLineString.
> https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/functions_list.html#line-merge
> 
> Regards.
> 
> Andrea Giudiceandrea
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Nicolas Cadieux
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  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  
>> 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  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 
>>>  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  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@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Nicolas Cadieux
Hi,
This is the plugin I was referring to.  I don’t see it in the current plugins 
(experimental turned on)  so I figured it’s QGIS 2 only.

https://github.com/ArMoraer/QGISMergeLines

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 30 août 2021 à 06:56, Nicolas Cadieux  a 
> écrit :
> 
> Hi,
> 
> Thanks for the info.  There was also a line_merge (or merge line) plugin.   
> The problem with the function that you are indicating is that it take a 
> single Multilinestring and create a simple linestring if the ends are 
> connected.  What I am looking for is a way to select a file made of simple 
> linestrings and to merged them into a single multilinestring if they share a 
> node or share and object that shares a node.  So, for example, if you had two 
> cities separated by a river (and there was no way to cross the river), all 
> the roads would be merged in two objects, one for each city.
> 
> This post explains what I would like.  It offer a QGIS 2 script that could 
> help. 
> https://gis.stackexchange.com/questions/198317/join-merge-lines-that-touch-and-intersect-in-qgis
> 
> I will share a file with and example of what I am looking for.
> 
> Nicolas Cadieux
> https://gitlab.com/njacadieux
> 
>>> Le 29 août 2021 à 17:12, Andrea Giudiceandrea  a 
>>> écrit :
>>> 
>> 
>>> 
>>> Nicolas Cadieux Sun, 29 Aug 2021 08:18:08 -0700
>> 
>>> I did see a merge function but did not find the line_merge plugin in  the 
>>> repository.
>> 
>> Hi Nicolas,
>> "line_merge" is not a plugin. It is a function  available in QGIS expression 
>> / field calculator:
>> 
>> 14.3.13.53. line_merge
>> Returns a LineString or MultiLineString geometry, where any connected 
>> LineStrings from the input geometry have been merged into a single 
>> linestring. This function will return NULL if passed a geometry which is not 
>> a LineString/MultiLineString.
>> https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/functions_list.html#line-merge
>> 
>> Regards.
>> 
>> Andrea Giudiceandrea
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread David Strip

  
  
I looked at the source for this plug-in and as far as I can tell  it
only merges lines that meet at endpoints. It ignores multi-lines,
and only creates linestrings, so there are no vertices of degree
>2 (ie, no junctions/forks). Also, the plug-in doesn't look for
intersections between vertices (since it only looks to merge
endpoints.)
The StackExchange post appears to want multi-linestrings, which
gives forks and such. Is that what you need? 

On 8/30/2021 5:27 AM, Nicolas Cadieux wrote:

  
  Hi,
  This is the plugin I was referring to.  I don’t see it in the
current plugins (experimental turned on)  so I figured it’s QGIS
2 only.


https://github.com/ArMoraer/QGISMergeLines
  
  Nicolas Cadieux
https://gitlab.com/njacadieux
  
  
  

  


  

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Nicolas Cadieux
Hi Andrea,

That is great news.  It may work for me in certain conditions.  Will the plugin 
pop up in processing?  It would be nice to include it in the QGIS plugin 
directory so that more people have access to it.

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 30 août 2021 à 15:08, Andrea Giudiceandrea  a écrit 
> :
> 
> Nicolas Cadieux Mon, 30 Aug 2021 04:27:27 -0700
>> This is the plugin I was referring to.  I don’t see it in the current 
>> plugins (experimental turned on)  so I figured it’s QGIS 2 only.
>> https://github.com/ArMoraer/QGISMergeLines
> 
> Hi Nicolas,
> I've ported that plugin to QGIS3.
> 
> You could download and install the new plugin version (hopefully working 
> without issues on QGIS 3.16) from 
> https://github.com/agiudiceandrea/QGISMergeLines
> 
> Anyway, I don't think it does what you need.
> 
> Regards.
> 
> Andrea
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Nicolas Cadieux
Hi,

Seems like the plugin is available so I will try it out.  The ability to create 
multi-linestring out of any touching lines (touch here means intersects at the 
first or last node) would be nice to have it if I can include it in a model. 

My goal is for this model to work for anyone with a basic install of QGIS LTR 
or 3.20 with minimal efforts so I am trying to eliminate the need to rely on 
external plugins or scripts.

This is also my first attempt with models. It’s a learning curve but I am 
having fun… I think this probably should have been a plugin but my knowledge of 
GUI programming is basically 0.  That will be for a next project…

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 30 août 2021 à 14:59, David Strip  a écrit :
> 
>  I looked at the source for this plug-in and as far as I can tell  it only 
> merges lines that meet at endpoints. It ignores multi-lines, and only creates 
> linestrings, so there are no vertices of degree >2 (ie, no junctions/forks). 
> Also, the plug-in doesn't look for intersections between vertices (since it 
> only looks to merge endpoints.)
> The StackExchange post appears to want multi-linestrings, which gives forks 
> and such. Is that what you need? 
> 
>> On 8/30/2021 5:27 AM, Nicolas Cadieux wrote:
>> Hi,
>> This is the plugin I was referring to.  I don’t see it in the current 
>> plugins (experimental turned on)  so I figured it’s QGIS 2 only.
>> 
>> https://github.com/ArMoraer/QGISMergeLines
>> 
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>> 
> 
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Charles Dixon-Paver
I thought this would be easily solved with an expression but sadly I
haven't been able to get reliable results at all.

My first thought was
collect($geometry,filter:=intersects($geometry,geometry(@parent))) and when
that didn't work I tried various aggregates and union operations to no
avail. Something like this might be useful if you can get it into a usable
form (I managed to get various multigeometries in the form you are looking
for but wasn't able to do much with them and there seemed to be artifacts):

collect_geometries(array_foreach(aggregate(layer:='lines',aggregate:='array_agg',expression:=$geometry,filter:=intersects($geometry,geometry(@parent))),@element))

I was actually waiting for someone else to come up with a more elegant
solution, but it would probably also be possible to identify intersecting
features and get the minimum/ maximum feature id for intersecting features
with this:

aggregate(layer:='lines',
aggregate:='min',
expression:="fid",
filter:=intersects($geometry,geometry(@parent)))

You could use that in the field calculator to create a field for "grouping"
various intersecting features to dissolve on, however it's only going to
identify the minimum of the currently intersecting features so you would
need to iterate through the process multiple times. I can't think of an
effective way to implement a "while" conditional either.

It's a pretty clanky way to do it, but if you are really struggling I think
it's possible.

On Mon, 30 Aug 2021 at 22:10, Nicolas Cadieux 
wrote:

> Hi,
>
> Seems like the plugin is available so I will try it out.  The ability to
> create multi-linestring out of any touching lines (touch here means
> intersects at the first or last node) would be nice to have it if I can
> include it in a model.
>
> My goal is for this model to work for anyone with a basic install of QGIS
> LTR or 3.20 with minimal efforts so I am trying to eliminate the need to
> rely on external plugins or scripts.
>
> This is also my first attempt with models. It’s a learning curve but I am
> having fun… I think this probably should have been a plugin but my
> knowledge of GUI programming is basically 0.  That will be for a next
> project…
>
> Nicolas Cadieux
> https://gitlab.com/njacadieux
>
> Le 30 août 2021 à 14:59, David Strip  a écrit :
>
>  I looked at the source for this plug-in and as far as I can tell  it
> only merges lines that meet at endpoints. It ignores multi-lines, and only
> creates linestrings, so there are no vertices of degree >2 (ie, no
> junctions/forks). Also, the plug-in doesn't look for intersections between
> vertices (since it only looks to merge endpoints.)
> The StackExchange post appears to want multi-linestrings, which gives
> forks and such. Is that what you need?
>
> On 8/30/2021 5:27 AM, Nicolas Cadieux wrote:
>
> Hi,
> This is the plugin I was referring to.  I don’t see it in the current
> plugins (experimental turned on)  so I figured it’s QGIS 2 only.
>
> https://github.com/ArMoraer/QGISMergeLines
>
> Nicolas Cadieux
> https://gitlab.com/njacadieux
>
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Nicolas Cadieux

Thanks Charles,

This will be very useful. Nice to know I'am not the only one going crazy 
with this!!!


Nicolas

On 2021-08-30 4:42 p.m., Charles Dixon-Paver wrote:
I thought this would be easily solved with an expression but sadly I 
haven't been able to get reliable results at all.


My first thought was 
collect($geometry,filter:=intersects($geometry,geometry(@parent))) and 
when that didn't work I tried various aggregates and union operations 
to no avail. Something like this might be useful if you can get it 
into a usable form (I managed to get various multigeometries in the 
form you are looking for but wasn't able to do much with them and 
there seemed to be artifacts):


collect_geometries(array_foreach(aggregate(layer:='lines',aggregate:='array_agg',expression:=$geometry,filter:=intersects($geometry,geometry(@parent))),@element))

I was actually waiting for someone else to come up with a more elegant 
solution, but it would probably also be possible to identify 
intersecting features and get the minimum/ maximum feature id for 
intersecting features with this:


aggregate(layer:='lines',
aggregate:='min',
expression:="fid",
filter:=intersects($geometry,geometry(@parent)))

You could use that in the field calculator to create a field for 
"grouping" various intersecting features to dissolve on, however it's 
only going to identify the minimum of the currently intersecting 
features so you would need to iterate through the process multiple 
times. I can't think of an effective way to implement a "while" 
conditional either.


It's a pretty clanky way to do it, but if you are really struggling I 
think it's possible.


On Mon, 30 Aug 2021 at 22:10, Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> wrote:


Hi,

Seems like the plugin is available so I will try it out.  The
ability to create multi-linestring out of any touching lines
(touch here means intersects at the first or last node) would be
nice to have it if I can include it in a model.

My goal is for this model to work for anyone with a basic install
of QGIS LTR or 3.20 with minimal efforts so I am trying to
eliminate the need to rely on external plugins or scripts.

This is also my first attempt with models. It’s a learning curve
but I am having fun… I think this probably should have been a
plugin but my knowledge of GUI programming is basically 0.  That
will be for a next project…

Nicolas Cadieux
https://gitlab.com/njacadieux 


Le 30 août 2021 à 14:59, David Strip mailto:qgis-u...@stripfamily.net>> a écrit :

 I looked at the source for this plug-in and as far as I can
tell  it only merges lines that meet at endpoints. It ignores
multi-lines, and only creates linestrings, so there are no
vertices of degree >2 (ie, no junctions/forks). Also, the plug-in
doesn't look for intersections between vertices (since it only
looks to merge endpoints.)
The StackExchange post appears to want multi-linestrings, which
gives forks and such. Is that what you need?

On 8/30/2021 5:27 AM, Nicolas Cadieux wrote:

Hi,
This is the plugin I was referring to.  I don’t see it in the
current plugins (experimental turned on)  so I figured it’s QGIS
2 only.

https://github.com/ArMoraer/QGISMergeLines


Nicolas Cadieux
https://gitlab.com/njacadieux 




___
Qgis-user mailing list
Qgis-user@lists.osgeo.org 
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user



--
Nicolas Cadieux
https://gitlab.com/njacadieux

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-30 Thread Andrea Giudiceandrea

Nicolas Cadieux Mon, 30 Aug 2021 04:27:27 -0700
This is the plugin I was referring to.  I don’t see it in the current plugins 
(experimental turned on)  so I figured it’s QGIS 2 only.


https://github.com/ArMoraer/QGISMergeLines


Hi Nicolas,
I've ported that plugin to QGIS3.

You could download and install the new plugin version (hopefully working 
without issues on QGIS 3.16) from 
https://github.com/agiudiceandrea/QGISMergeLines


Anyway, I don't think it does what you need.

Regards.

Andrea
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-31 Thread DelazJ
Hi,

> 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.

Nicolas, can you elaborate a bit more on the issues you have with the
"Dissolve + Multipart to singleparts" solution I provided few days ago. At
which step is it failing? The dissolve does not merge joining features into
a single one? I don't know the function internals but I'd expect it to work
this way and if not, would sound like a bug to report IMHO...

Regards,
Harrissou

Le mar. 31 août 2021 à 00:57, Nicolas Cadieux 
a écrit :

> Thanks Charles,
>
> This will be very useful. Nice to know I'am not the only one going crazy
> with this!!!
>
> Nicolas
> On 2021-08-30 4:42 p.m., Charles Dixon-Paver wrote:
>
> I thought this would be easily solved with an expression but sadly I
> haven't been able to get reliable results at all.
>
> My first thought was
> collect($geometry,filter:=intersects($geometry,geometry(@parent))) and
> when that didn't work I tried various aggregates and union operations to no
> avail. Something like this might be useful if you can get it into a usable
> form (I managed to get various multigeometries in the form you are looking
> for but wasn't able to do much with them and there seemed to be artifacts):
>
>
> collect_geometries(array_foreach(aggregate(layer:='lines',aggregate:='array_agg',expression:=$geometry,filter:=intersects($geometry,geometry(@parent))),@element))
>
> I was actually waiting for someone else to come up with a more elegant
> solution, but it would probably also be possible to identify intersecting
> features and get the minimum/ maximum feature id for intersecting features
> with this:
>
> aggregate(layer:='lines',
> aggregate:='min',
> expression:="fid",
> filter:=intersects($geometry,geometry(@parent)))
>
> You could use that in the field calculator to create a field for
> "grouping" various intersecting features to dissolve on, however it's only
> going to identify the minimum of the currently intersecting features so you
> would need to iterate through the process multiple times. I can't think of
> an effective way to implement a "while" conditional either.
>
> It's a pretty clanky way to do it, but if you are really struggling I
> think it's possible.
>
> On Mon, 30 Aug 2021 at 22:10, Nicolas Cadieux 
> wrote:
>
>> Hi,
>>
>> Seems like the plugin is available so I will try it out.  The ability to
>> create multi-linestring out of any touching lines (touch here means
>> intersects at the first or last node) would be nice to have it if I can
>> include it in a model.
>>
>> My goal is for this model to work for anyone with a basic install of QGIS
>> LTR or 3.20 with minimal efforts so I am trying to eliminate the need to
>> rely on external plugins or scripts.
>>
>> This is also my first attempt with models. It’s a learning curve but I am
>> having fun… I think this probably should have been a plugin but my
>> knowledge of GUI programming is basically 0.  That will be for a next
>> project…
>>
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>>
>> Le 30 août 2021 à 14:59, David Strip  a
>> écrit :
>>
>>  I looked at the source for this plug-in and as far as I can tell  it
>> only merges lines that meet at endpoints. It ignores multi-lines, and only
>> creates linestrings, so there are no vertices of degree >2 (ie, no
>> junctions/forks). Also, the plug-in doesn't look for intersections between
>> vertices (since it only looks to merge endpoints.)
>> The StackExchange post appears to want multi-linestrings, which gives
>> forks and such. Is that what you need?
>>
>> On 8/30/2021 5:27 AM, Nicolas Cadieux wrote:
>>
>> Hi,
>> This is the plugin I was referring to.  I don’t see it in the current
>> plugins (experimental turned on)  so I figured it’s QGIS 2 only.
>>
>> https://github.com/ArMoraer/QGISMergeLines
>>
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>>
>>
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> --
> Nicolas Cadieuxhttps://gitlab.com/njacadieux
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-08-31 Thread Nicolas Cadieux
Hi,

I will look at the wkt output but it seems that with lines, dissolve will just 
create a single huge multiline.  The multi part to single part will just split 
it back up.  I suspect that dissolve only deals with common border in polygones 
and not line ends.  Will test tomorrow to figure out more details.

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 31 août 2021 à 03:57, DelazJ  a écrit :
> 
> 
> Hi,
> 
> > 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.
> 
> Nicolas, can you elaborate a bit more on the issues you have with the 
> "Dissolve + Multipart to singleparts" solution I provided few days ago. At 
> which step is it failing? The dissolve does not merge joining features into a 
> single one? I don't know the function internals but I'd expect it to work 
> this way and if not, would sound like a bug to report IMHO...
> 
> Regards,
> Harrissou
> 
>> Le mar. 31 août 2021 à 00:57, Nicolas Cadieux  
>> a écrit :
>> Thanks Charles,
>> 
>> This will be very useful. Nice to know I'am not the only one going crazy 
>> with this!!!
>> 
>> Nicolas
>> 
>> On 2021-08-30 4:42 p.m., Charles Dixon-Paver wrote:
>>> I thought this would be easily solved with an expression but sadly I 
>>> haven't been able to get reliable results at all.
>>> 
>>> My first thought was 
>>> collect($geometry,filter:=intersects($geometry,geometry(@parent))) and when 
>>> that didn't work I tried various aggregates and union operations to no 
>>> avail. Something like this might be useful if you can get it into a usable 
>>> form (I managed to get various multigeometries in the form you are looking 
>>> for but wasn't able to do much with them and there seemed to be artifacts):
>>> 
>>> collect_geometries(array_foreach(aggregate(layer:='lines',aggregate:='array_agg',expression:=$geometry,filter:=intersects($geometry,geometry(@parent))),@element))
>>> 
>>> I was actually waiting for someone else to come up with a more elegant 
>>> solution, but it would probably also be possible to identify intersecting 
>>> features and get the minimum/ maximum feature id for intersecting features 
>>> with this:
>>> 
>>> aggregate(layer:='lines',
>>> aggregate:='min',
>>> expression:="fid",
>>> filter:=intersects($geometry,geometry(@parent)))
>>> 
>>> You could use that in the field calculator to create a field for "grouping" 
>>> various intersecting features to dissolve on, however it's only going to 
>>> identify the minimum of the currently intersecting features so you would 
>>> need to iterate through the process multiple times. I can't think of an 
>>> effective way to implement a "while" conditional either.
>>> 
>>> It's a pretty clanky way to do it, but if you are really struggling I think 
>>> it's possible.
>>> 
>>> On Mon, 30 Aug 2021 at 22:10, Nicolas Cadieux  
>>> wrote:
 Hi,
 
 Seems like the plugin is available so I will try it out.  The ability to 
 create multi-linestring out of any touching lines (touch here means 
 intersects at the first or last node) would be nice to have it if I can 
 include it in a model. 
 
 My goal is for this model to work for anyone with a basic install of QGIS 
 LTR or 3.20 with minimal efforts so I am trying to eliminate the need to 
 rely on external plugins or scripts.
 
 This is also my first attempt with models. It’s a learning curve but I am 
 having fun… I think this probably should have been a plugin but my 
 knowledge of GUI programming is basically 0.  That will be for a next 
 project…
 
 Nicolas Cadieux
 https://gitlab.com/njacadieux
 
> Le 30 août 2021 à 14:59, David Strip  a écrit :
> 
>  I looked at the source for this plug-in and as far as I can tell  it 
> only merges lines that meet at endpoints. It ignores multi-lines, and 
> only creates linestrings, so there are no vertices of degree >2 (ie, no 
> junctions/forks). Also, the plug-in doesn't look for intersections 
> between vertices (since it only looks to merge endpoints.)
> The StackExchange post appears to want multi-linestrings, which gives 
> forks and such. Is that what you need? 
> 
>> On 8/30/2021 5:27 AM, Nicolas Cadieux wrote:
>> Hi,
>> This is the plugin I was referring to.  I don’t see it in the current 
>> plugins (experimental turned on)  so I figured it’s QGIS 2 only.
>> 
>> https://github.com/ArMoraer/QGISMergeLines
>> 
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>> 
> 
 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
 Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> -- 
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux
>> _

Re: [Qgis-user] Line dissolve

2021-09-01 Thread Andrea Giudiceandrea

Nicolas Cadieux Mon, 30 Aug 2021 03:56:22 -0700
This post explains what I would like.  It offer a QGIS 2 script that could 
help. 
https://gis.stackexchange.com/questions/198317/join-merge-lines-that-touch-and-intersect-in-qgis


Hi Nicolas,
I've also successfully ported that script to QGSI 3 as a processing script.
Since it appears the script was originally published on StackExchange by 
Jochen Schwarze, it has an implicit cc-by-sa license not really suitable 
for software code...


I'm trying to contact the author as a courtesy to know if he wants to 
publish himself the code with a GPLv2+ license on a collaborative 
version control website, maintain it and eventually let it available on 
plugins.qgis.org so I can submit my changes to him...


Anyway, you can find a version of the code modified by me to work as a 
processing script in QGIS 3.


It adds a subnet field to a line type layer. The field will contain the 
same unique progressive integer value for all the feature that are not 
disjoint (i.e. having any common node or are intersecting) to the other 
features.


You will find it at 
https://gist.github.com/agiudiceandrea/621e4f0f2804e49cbd6f2a4314c0e482


Be aware that for now the processing script doesn't have a proper 
progress and cancel feedback mechanism or any other sophisticated error 
checking and handling and I don't know what its performance is with 
layers containing a lot of features...


Regards.

Andrea
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-09-01 Thread Nicolas Cadieux
Thanks!
 Very informative and useful. I will have a look.

Nicolas Cadieux
https://gitlab.com/njacadieux

> Le 1 sept. 2021 à 03:33, Andrea Giudiceandrea  a écrit 
> :
> 
> Nicolas Cadieux Mon, 30 Aug 2021 03:56:22 -0700
>> This post explains what I would like.  It offer a QGIS 2 script that could 
>> help. 
>> https://gis.stackexchange.com/questions/198317/join-merge-lines-that-touch-and-intersect-in-qgis
> 
> Hi Nicolas,
> I've also successfully ported that script to QGSI 3 as a processing script.
> Since it appears the script was originally published on StackExchange by 
> Jochen Schwarze, it has an implicit cc-by-sa license not really suitable for 
> software code...
> 
> I'm trying to contact the author as a courtesy to know if he wants to publish 
> himself the code with a GPLv2+ license on a collaborative version control 
> website, maintain it and eventually let it available on plugins.qgis.org so I 
> can submit my changes to him...
> 
> Anyway, you can find a version of the code modified by me to work as a 
> processing script in QGIS 3.
> 
> It adds a subnet field to a line type layer. The field will contain the same 
> unique progressive integer value for all the feature that are not disjoint 
> (i.e. having any common node or are intersecting) to the other features.
> 
> You will find it at 
> https://gist.github.com/agiudiceandrea/621e4f0f2804e49cbd6f2a4314c0e482
> 
> Be aware that for now the processing script doesn't have a proper progress 
> and cancel feedback mechanism or any other sophisticated error checking and 
> handling and I don't know what its performance is with layers containing a 
> lot of features...
> 
> Regards.
> 
> Andrea
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Line dissolve

2021-09-02 Thread Nicolas Cadieux

Hi Harrissou,

Turn out I had a float point error problem with the distance matrix tool 
that indicated I had no disconnected lines in my network.  The distance 
matrix tool reports 0 distance when the distance is around or below the 
10th decimal point.   I have fixed the problem and dissolve followed by 
multipart to single part does work with lines like it does with polygons 
and does dissolve line ends.  I will report the error on the distance 
matrix tool that I was using to find my disconnected line nodes.


Thanks for your help and for insisting I figure out problem.

Nicolas

On 2021-08-31 11:20 p.m., Nicolas Cadieux wrote:

Hi,

I will look at the wkt output but it seems that with lines, dissolve 
will just create a single huge multiline.  The multi part to single 
part will just split it back up.  I suspect that dissolve only deals 
with common border in polygones and not line ends.  Will test tomorrow 
to figure out more details.


Nicolas Cadieux
https://gitlab.com/njacadieux 


Le 31 août 2021 à 03:57, DelazJ  a écrit :


Hi,

> 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.


Nicolas, can you elaborate a bit more on the issues you have with the 
"Dissolve + Multipart to singleparts" solution I provided few days 
ago. At which step is it failing? The dissolve does not merge joining 
features into a single one? I don't know the function internals but 
I'd expect it to work this way and if not, would sound like a bug to 
report IMHO...


Regards,
Harrissou

Le mar. 31 août 2021 à 00:57, Nicolas Cadieux 
mailto:njacadieux.git...@gmail.com>> a 
écrit :


Thanks Charles,

This will be very useful. Nice to know I'am not the only one
going crazy with this!!!

Nicolas

On 2021-08-30 4:42 p.m., Charles Dixon-Paver wrote:

I thought this would be easily solved with an expression but
sadly I haven't been able to get reliable results at all.

My first thought was
collect($geometry,filter:=intersects($geometry,geometry(@parent)))
and when that didn't work I tried various aggregates and union
operations to no avail. Something like this might be useful if
you can get it into a usable form (I managed to get various
multigeometries in the form you are looking for but wasn't able
to do much with them and there seemed to be artifacts):


collect_geometries(array_foreach(aggregate(layer:='lines',aggregate:='array_agg',expression:=$geometry,filter:=intersects($geometry,geometry(@parent))),@element))

I was actually waiting for someone else to come up with a more
elegant solution, but it would probably also be possible to
identify intersecting features and get the minimum/ maximum
feature id for intersecting features with this:

aggregate(layer:='lines',
aggregate:='min',
expression:="fid",
filter:=intersects($geometry,geometry(@parent)))

You could use that in the field calculator to create a field for
"grouping" various intersecting features to dissolve on, however
it's only going to identify the minimum of the currently
intersecting features so you would need to iterate through the
process multiple times. I can't think of an effective way to
implement a "while" conditional either.

It's a pretty clanky way to do it, but if you are really
struggling I think it's possible.

On Mon, 30 Aug 2021 at 22:10, Nicolas Cadieux
mailto:njacadieux.git...@gmail.com>> wrote:

Hi,

Seems like the plugin is available so I will try it out. 
The ability to create multi-linestring out of any touching
lines (touch here means intersects at the first or last
node) would be nice to have it if I can include it in a model.

My goal is for this model to work for anyone with a basic
install of QGIS LTR or 3.20 with minimal efforts so I am
trying to eliminate the need to rely on external plugins or
scripts.

This is also my first attempt with models. It’s a learning
curve but I am having fun… I think this probably should have
been a plugin but my knowledge of GUI programming is
basically 0.  That will be for a next project…

Nicolas Cadieux
https://gitlab.com/njacadieux 


Le 30 août 2021 à 14:59, David Strip
mailto:qgis-u...@stripfamily.net>> a écrit :

 I looked at the source for this plug-in and as far as I
can tell  it only merges lines that meet at endpoints. It
ignores multi-lines, and only creates linestrings, so there
are no vertices of degree >2 (ie, no junctions/forks).
Also, the plug-in doesn't look for intersections between
vertices (since it only looks to merge endpoints.)
The StackExchange post appears to want multi-linestrings,