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

Overpass area query by ID instead of by NAME

1

Hi OSMappers,

I'm using overpass to get all the suburbs of a city. I can do it by setting this option:

area[name="CITY NAME"]

but what I want to is to get the infos by the ID of the city instead. Is it possible to do something like this?

area[id="CITY ID"]

This is my actual url:

http://MY-URL.com/api/interpreter?data=[out:csv(::type,"place",::id,"name",::lat,::lon)];area[name="CITY NAME"][admin_level=8][boundary=administrative]->.RESULTS;rel(pivot.RESULTS);node[place="suburb"](area.RESULTS);out;

Thanks in advance!

asked 11 Jun '17, 10:26

carapace's gravatar image

carapace
26113
accept rate: 0%


One Answer:

3

If by city id you mean an OSM id for an object representing a city, there is a mapping between OSM ids and Overpass areas. There is decent discussion of how it works in the documentation: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29

answered 11 Jun '17, 14:15

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Source code available on GitHub .