Building out roadways by name through roundabouts

I’m currently trying to build out a feature which navigates a certain distance down a specific road (without deviating from it), but I’ve been running into an issue specifically with roundabouts which have one-way roads branching off them. The issue for me, primarily, is with figuring out how the algorithm should determine which road is leaving the roundabout vs which is staying on the roundabout. Below is an example:

The diverging arrows have two different paths which both are in the same direction and both have the same road name (CG-2), and I’ve tried a few solutions which didn’t always work (like choosing the edge of a greater distance to prioritize escape). Entertaining both possible roadways hasn’t worked for me either because the road could easily loop all the way through the roundabout and build out in the opposite direction which I don’t want.

Normally, the roundabout has the proper name, so that’s not an issue for me. If anyone has an potential solutions, it’d be greatly appreciated!

The roundabout usually has a separate tagging and we store this in the roundabout encoded value which you could use to find out this difference.

But sometimes OSM includes the arms of the roundabout although this is a tagging mistake I think: Tag:junction=roundabout - OpenStreetMap Wiki

1 Like