3

I'm using a polyline river layer in QGIS to calculate river miles, but am ending up with points out of order. Starting with a river layer that is broken into reaches (short sections), I'm dissolving into a new layer based on the stream name. I am then calculating the distance along the line (I've tried two separate plugins, "Locate points along lines", and "Qchainage").
Unfortunately, some segments seem to be out of order, so the distance along the line jumps around, and sometimes go in opposite directions.
I end up with river miles that look like : enter image description here The segment with miles 9-11 is between the segments with 0-5 and 6-8

I suspect this crops up in the dissolve stage because of some feature of the original data. Is there a way to dissolve the lines into sections that are continuous lines without misaligned segments?

Here is a link to the shapefile I'm working with. It's in a zip on dropbox. This version has been converted to single parts, with all the lines going in the same direction. zipped shapefile on dropbox

5
  • I looked into Join Multiple Lines, but it throws a python error, might not be updated for QGIS 3.x Nov 30, 2018 at 15:25
  • Are you sure the stream name spellings are consistent? If you have eg, four segments called ('Mud Brook', 'Mud Brook', 'Mud Br.', 'Mud Br.', and 'Mud Brook') and you dissolve them, you'll end up with one discontinous section called 'Mud Brook' with a segment in the middle called 'Mud Br.'. Also check that the final vertex of each segment is snapped to the first vertex of the next segment.
    – csk
    Nov 30, 2018 at 17:03
  • @csk Yes, the all of the appropriate segments are dissolving into one feature. I'm ending up with the correct number of features in my dissolved layer. I also spot checked a couple segments that are not showing up in the right order, and they seem to be snapping together. Nov 30, 2018 at 17:56
  • Did you find a solution for this? I have a similar question here gis.stackexchange.com/questions/290292/…
    – GeorgeC
    Feb 11, 2019 at 1:30
  • 1
    @GeorgeC No, I did not find a solution. I ended up re-digitizing the lines I needed. Feb 12, 2019 at 18:18

1 Answer 1

1

If your reaches where not all digitized in the same direction, after dissolving you may end with a multipart line (that will look like a single continuous line but have several segment not necessarily in logical order)

You should check the direction of your segment before dissolving (you may use an arrow symbology for that) and flip any segment that is not digitized in the same direction as the flow.

Also you may check that some of your reaches are not already multipart before dissolving.

6
  • This addresses the minor problem of the flipped lines, but not the major one of the line segments not ending up in a continuous order. I've edited the question to include a figure showing what I mean. Nov 30, 2018 at 16:20
  • Your final goal should be one continuous linestring instead of an organized multilinestring.
    – user30184
    Nov 30, 2018 at 17:06
  • You may check that your vertices have no M value that may dictate the order of the segment, or run a topology to ensure that each last vertice of your segment are superposed to the first vertice of the next. if that doesn't solve your problem I have no more idea...
    – J.R
    Nov 30, 2018 at 17:06
  • @user30184 that's exactly the problem. I thought I would end up with a contnuous linestring by dissolving the line segments together, but it's not the result I'm ending up with. Is there another tool that forces the result to come out as a linestring rather than multilinestring? Nov 30, 2018 at 17:59
  • I tried running multiparts to single parts before I dissolved my layer, and have checked several of the features to be sure they are laying out on top of one another. Multipart to single part did show that there were several multi part line strings in the initial file, but did not change the final result at all. Dissolving the single part features still resulted in a multilinestring feature type in the resulting layer. Nov 30, 2018 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.