1

I have two polylines shapefiles that I wish to join together spatially. One is a road network and the other consists of bus routes which I have calculated the frequency over a certain period of time. I then wish to change the size of road segments based on this frequency.

I have found a successful way to do it in ArcMap, using the "SHARE_A_LINE_SEGMENT_WITH" option in the Spatial Join tool. Afterwards, I dissolve the joined shapefile based on the road_id column and sum the frequency column, also in ArcMap.

As shown in this great visual example, share a line segment with is quite different from intersect, contains, within or other methods offered in QGIS.

Is there some way to perform this type of spatial join in QGIS, whether with a tool, plugin, or spatial SQL query?

My python knowledge is really poor.

How to find share segments between two shapes (line) using QGIS? seems to be the same question as mine, however I can't comment to ask if there is any update.

Also, I found Understanding Join Attributes by Location in QGIS? for QGIS, where no operation seems to be what I want exactly.

This is the road network:

road shapefile

With bus routes on top:

bus and road shapefiles

When I do a simple intersect, i'm left with a bunch of routes (in red) that shouldn't be there (circled in blue). I' guessing because of the segment ends.

intersect

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
mikibok
  • 47
  • 6

1 Answers1

1
  1. dissolve the road network
  2. extract the vertices as points
  3. split the road network with those points. This can be done with the SAGA tool split lines at points (in the Processing Toolbox under vector line tools).
  4. do a spatial join (using the tool join attributes by location) with the "equals" geometry predicate

For a large or complicated road network the spatial join with the extracted nodes may take a while (in this case around 15-20 minutes). It should be faster to first intersect the road network, then run the above process on the intersected network.

csk
  • 24,827
  • 3
  • 32
  • 70