4

I have a line shapefile that has overlapping on certain portion of the line features. I need to know the count of where these overlapping occurs and if there is no overlap to keep it as Null or 0 as it still a count of 1 line that passes through the route. I have a point shapefile of where these lines start and end.

Eg. A line runs from 1>2 another lines run from 1>3 and one from 1>5. A line runs from 2>3 and another line from 3>4.
In the portion of the red box I know there should be overlapping as the lines that feed 1>2, 1>3 and 1>5 have the same route (geographic location as well). Portions 2>3 and 3>4 of the line has no overlap.

I am trying to figure out a workflow and I am using QGIS 2.18. Any ideas?

Visual Summary of what I need to achieve :)

2
  • Just to be pedantic, I believe there should be a 2 between 2 & 3 (a line runs from 1>3, and another from 2>3).
    – phloem
    Jul 26, 2018 at 21:22
  • You are right @phloem :) Jul 26, 2018 at 21:25

1 Answer 1

7

You can (1) break these lines into segments, (2) count overlapping segments, and (3) keep only one feature at each location (while removing others) just for labeling.


(1) Explode lines (Processing Toolbox | QGIS geoalgorithms | Vector geometry tools) to break polylines into segments.

(2) Open the attribute table of the above exploded layer. Start the Field Calculator and create a new integer field with an expression count("id", group_by:=geom_to_wkt($geometry)) ... if you have id field.

(3) Remove duplicated segments by Delete duplicate geometries (Processing Toolbox | QGIS geoalgorithms | Vector general tools). This will ensure not to show multiple labels at each segment.

5
  • 1
    I have tried workflow suggested but it gives me wrong counts. Aug 3, 2018 at 16:16
  • @geogeek-pkav That's too bad. Umm...perhaps your lines are not topologically aligned each other?
    – Kazuhito
    Aug 5, 2018 at 8:14
  • @kashuito can you help me with the following: gis.stackexchange.com/questions/295613/… Sep 19, 2018 at 14:16
  • Hi @geogeek-pkav Yes I will try to look into the question.
    – Kazuhito
    Sep 19, 2018 at 14:23
  • @geogeek-pkav I made a couple of tests on your other question, but could not find a viable solution. Sorry.
    – Kazuhito
    Sep 20, 2018 at 9:55

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.