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 :)

PolyGeo
  • 65,136
  • 29
  • 109
  • 338

1 Answers1

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.

Kazuhito
  • 30,746
  • 5
  • 69
  • 149