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

  • 2
    Do the geometries overlap exactly? – Erik Oct 11 '19 at 14:55
  • 2
    extract the vertices as points, split the road network with those points, and do a spatial join with the "equals" geometry predicate. – csk Oct 11 '19 at 14:58
  • Or do a simple intersect, this should work, if the geometries match. – Erik Oct 11 '19 at 15:00
  • @Erik Yes they overlap exactly. Please see my edit. – mikibok Oct 11 '19 at 15:19
  • not answering the question but why not simply change the bus route size ? – J.R Oct 11 '19 at 15:25
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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