-1

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!

Youkai
  • 3
  • 2
  • 1
    crosspost: https://gis.stackexchange.com/questions/340207/find-out-if-crossroad-or-3-way-intersection – scai Oct 30 '19 at 09:40
  • Similar question: https://stackoverflow.com/questions/58478621/filtering-intersections-to-4-way-intersections-t-junctions-and-other-using – mmd Nov 02 '19 at 10:03

1 Answers1

2

You have to look at the junction node, too.

Some examples:

If the node is part of two ways and..

  • these ways have other nodes before and after this node ID then you have a 4-way-junction.
  • only one way has other nodes before and after this node ID then you have a 3-way-junction
  • none of these ways have other nodes before and after this node ID then it is not a junction. Instead, the way continues with a different ID.

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.

scai
  • 20,297
  • 4
  • 56
  • 72
  • 1
    Thanks, works quite well. For more than two ways I'm looking additionally if the junction node is equal to the first or last node of a way. 2 or 4 occurences mean 4-way, otherwise 3-way. That fits for me for now. – Youkai Nov 07 '19 at 12:03