What's the best-practice way to show multiple lanes for one OSM way in Mapbox GL JS?
Let's say we have the following OSM way which is a collection of nodes:
Is there an easy way to visualize e.g.:
- both driving directions at the same time
- multiple lanes which do not have own geometries in OSM
The following picture demonstrates what the solution would produce:
- The solution should work no matter of the direction of the way segments (angle)
- The solution should work in combination with zoom, i.e. when zooming out the lanes should stay "on the road" (this is not the case when using
line-offsete.g.) - It would be great if the solution can also handle special geometries like roundabouts
I could calculate the geometry for each way in a pre-processing step but I'm at least hoping to find existing solutions which can handle all angles and maybe eben special geometry like roundabouts.
Adding the lanes to OSM itself is no solution, as this needs to work e.g. when there is actually just one road lane which bicycles can ride in both directions.


Thanks for the reply anyways.
– hb0 Sep 12 '22 at 09:00