I'm trying to find out the type of a crossroad / intersection in overpass by given coordinates (simple 4-way-crossroad or 3-way-intersection aka Y/T intersection).
Wanted to count the way-id's I'm getting via json later in program code (4 = simple crossroad, 3 = Y or T) using the following query: http://overpass-turbo.eu/s/NyD
[out:json][timeout:15];
way["highway"](around:1,48.7986003,11.3759673);
foreach ->.w {
node(w.w);(way(bn);- .w;)->.wd;
out body geom;
};
Problem: This only works if a street ends at the crossroad / intersection or at least turns into another way-id. In this example there's a street which reaches from north to south and east. The east way got another way-id so that's not a problem. But from north to south it's just one way (so only one id). Result: I'm counting 3 but it should be 4 for this type of crossroad.
How do I solve this problem or is there a better way to identify the type of a crossroad / intersection?
Thank you very much!
You have to look at the junction node, too.
Some examples:
If the node is part of two ways and..
If the node is part of n ways and it is the last or first node of all these ways then you have a n-way-junction.
There will be some more cases than the ones mentioned above. Take a sheet of paper, draw some ways and their nodes onto it to get a better visualization of the data.
I'm not sure if this simple approach will work for all cases, though.