I have a road network file (openstreetmap exported file) that has various types of edges (freeway, highway, primary, residential, service, ...). Some of these edges have multiple lanes (parallel), so that each one of these lanes considered a separate edge in road network, for example: image

How can I merge these lanes in one lane and construct the road network algorithmic (I know in some applications, we can select ways and merge them with right click, but I can't do this for 100000+ edges in large cities)?

  • 2
    What software are you using?
    – LMB
    Feb 3, 2018 at 12:10

1 Answer 1


This sounds like a workload that you should script. Conceptually the following steps could be taken:

  1. For each road segment, check if there are roads near it (say, within 10 meters or so). You could also call this a 'select by location', with the 'Are within x distance' operation.
  2. For each road from 1, check if they are parallel and have the same speed limit (to avoid merging highways with smaller roads running parallel).
  3. Merge the selected roads.

The speudocode would be something like:

for road in roads:
 select other roads within 10 meters

for road in selected roads:
 caculate Linear Directional Mean
 Compare this with the main road you are comparing to
 if match:
  Merge road 1 and road 2

Your Answer

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

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