[Qgis-user] Line dissolve
Nicolas Cadieux
njacadieux.gitlab at gmail.com
Thu Sep 2 09:56:26 PDT 2021
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 <https://gitlab.com/njacadieux>
>
>> Le 31 août 2021 à 03:57, DelazJ <delazj at gmail.com> 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
>> <njacadieux.gitlab at gmail.com <mailto:njacadieux.gitlab at 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))), at 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
>>> <njacadieux.gitlab at gmail.com
>>> <mailto:njacadieux.gitlab at 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 <https://gitlab.com/njacadieux>
>>>
>>>> Le 30 août 2021 à 14:59, David Strip
>>>> <qgis-user at stripfamily.net
>>>> <mailto:qgis-user at 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
>>>>> <https://github.com/ArMoraer/QGISMergeLines>
>>>>>
>>>>> Nicolas Cadieux
>>>>> https://gitlab.com/njacadieux <https://gitlab.com/njacadieux>
>>>>>
>>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>>> List info:
>>> https://lists.osgeo.org/mailman/listinfo/qgis-user
>>> <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>> Unsubscribe:
>>> https://lists.osgeo.org/mailman/listinfo/qgis-user
>>> <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>>
>> --
>> Nicolas Cadieux
>> https://gitlab.com/njacadieux <https://gitlab.com/njacadieux>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>
--
Nicolas Cadieux
https://gitlab.com/njacadieux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210902/a7488e0c/attachment-0001.html>
More information about the Qgis-user
mailing list