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

Hello, I'm using Overpass API and I'm looking for a way to get everything which is in a city determined by the ID of its node. For instance, If we're getting a closer look to London, it shows :

 <node id="**107775**" lat="51.5072759" lon="-0.1276597">
    <tag k="capital" v="yes"/>
    <tag k="ele" v="15"/>
    <tag k="is_in" v="England, United Kingdom, UK, Great Britain, Europe"/>
    <tag k="is_in:continent" v="Europe"/>
    <tag k="is_in:country" v="United Kingdom"/>
    <tag k="media:commons" v="https://commons.wikimedia.org/wiki/Category:London"/>
    <tag k="name" v="London"/>
    [...]
    <tag k="website" v="http://www.london.gov.uk/"/>
    <tag k="wikipedia" v="en:London"/>
  </node>

I'd like to get the bounding box of this city thanks to its node ID (here : 107775). I managed to do this thanks to the name of the city by the request : (rel["name"='London'];>;);out; But as you can see, in case of multiple places with the same name, you get multiple bounding box. That's the reason why I'd like to get this bounding box thanks to the ID of the node associated to the city.

So, to sum um, with this node : node(107775), is it possible to get the bounding box of the city ?

Thanks

asked 11 Apr '13, 12:20

Kobz's gravatar image

Kobz
1112
accept rate: 0%

edited 11 Apr '13, 12:22

I am not really sure that I understand your question (a bounding box based on a node?!?) - however, maybe it helps that many cities have their boundaries mapped like this: http://www.openstreetmap.org/browse/relation/62400 Note that this does not applies to every city (remarkably small ones) as OSM's data quality varies.

(13 Apr '13, 01:37) aseerel4c26 ♦

First of all, it seems that you are not looking for exact bounding boxes of a certain city, but for its boundary relation.

Main problem: the binding from a node to its boundary relation is not completley mapped in the OSM data. There are some countries where you have boundary relations with one node as a member with the role admin_centre ... thus you ca find all place nodes that are member of a boundary relation.

But this binding is incomplete in the world, even in Germany this data model is not so widely spreaded.

see Relation:boundary in the OSM wiki.

Maybe also helpful: overpass-get-relation-and-node-in-one-query-for-city

permanent link

answered 15 Apr '13, 17:10

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

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
×107
×55
×11
×9

question asked: 11 Apr '13, 12:20

question was seen: 8,148 times

last updated: 15 Apr '13, 17:10

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