This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to query all junctions in a city

0

I am trying to get the node (for the GPS) of all driveable junctions in a city.
Here is what I have tried out :

import overpy

api = overpy.Overpass()

osmid_f = 62422 + 3600000000

result = api.query(

f"""

[timeout:1000][out:json];

area({osmid_f})->.a;
(
  node(area.a)

  ['junction' = 'circular']

  ['junction' = 'roundabout']

  ['junction' = 'jughandle']

  ['junction' = 'filter']

  ['traffic_calming' = 'island']

  ['highway' = 'mini_roundabout']

  ['highway' = 'turning_circle']

  ['highway' = 'turning_loop']

  ['highway' = 'motorway_junction']

  ['highway' = 'passing_place'];

  node(w)(area.a);

);

out;

""")

But I get an empty result. Is there something I am missing ?
I would appreciate any hints.
Thank you

asked 18 Dec '20, 09:17

Dykay's gravatar image

Dykay
36337
accept rate: 0%

edited 18 Dec '20, 10:15

scai's gravatar image

scai ♦
33.3k21309459


One Answer:

1

Your query is searching for nodes with all of those tags together. Make a separate query for each tag:

(
  node(area.a)[junction];
  node(area.a)[highway=mini_roundabout];
  ...
);

and so on. Some junctions might be modeled as ways, tagged as roundabouts (rather than mini_roundabouts).

answered 18 Dec '20, 16:31

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thank you @maxerickson

(19 Dec '20, 12:48) Dykay

Source code available on GitHub .