1

I found this query, which works for streets:

way[highway][name="Mexico Road"];node(w)->.n1;
way[highway][name="Bryan Road"];node(w)->.n2; 
node.n1.n2; 
out meta;

I assumed it would work for interstates but when I plug in "I 55" and "I 270" for example, it gives me nothing. The problem appears to be related to exit ramps being their own structures in the data model.

Does anyone know an equivalent that works for interstates or just all roads?

1

The query in your question looks for the road name. "I 55" and "I 270", however, are modeled in OSM using the ref tag because they aren't really names. You need to modify the query accordingly:

way[highway][ref="I 55"];node(w)->.n1;
way[highway][ref="I 270"];node(w)->.n2; 
node.n1.n2; 
out meta;

This won't return any results, though. The on/off ramps (in OSM called motorway links) such as this one or this one lack a proper ref tag. Link roads in OSM usually don't have a ref tag, instead they have destination:ref to specify which roads they lead to. Consequently you need to look for both tags. Also, destination:ref can contain multiple values separated by semicolon, so you need to look for partial matches using ~ instead of =:

(way[highway]["ref"="I 55"];way[highway]["destination:ref"~"I 55"];);node(w)->.n1;
(way[highway]["ref"="I 270"];way[highway]["destination:ref"~"I 270"];);node(w)->.n2; 
node.n1.n2; 
out meta;

Unfortunately this query runs out of memory. Maybe an Overpass API expert knows how to optimize it so that it will succeed.

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.