NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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%


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: http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29

permanent link

answered 11 Jun '17, 14:15

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×213
×54

question asked: 11 Jun '17, 10:26

question was seen: 9,119 times

last updated: 11 Jun '17, 14:15

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum