3

I want to generate the lists of states and cities (state wise cities) of Germany using overpass XAPI of OSM.

In wiki I can see this list http://en.wikipedia.org/wiki/States_of_Germany and http://en.wikipedia.org/wiki/List_of_cities_in_Germany_by_population

So according to wiki Germany has 16 states and 80 cities.

Now, to fetch the list of states in Germany I am using this query: http://www.overpass-api.de/api/xapi?node[bbox=5.87,47.27,15.04,55.12][type=administrative]

To fetch list of cities in Germany I am using this query: http://www.overpass-api.de/api/xapi?node[bbox=5.87,47.27,15.04,55.12][place=city]

So from my above queries I am getting 0 states and 114 cities. Which is absolutely wrong according to wiki. Please guide me if I am writing wrong query? Or suggest me some another way to fetch the list of states and cities from OSM.

asked 28 Jun '12, 10:39

Ravi%20Kotwani's gravatar image

Ravi Kotwani
136669
accept rate: 0%


2 Answers:
1

The states of Germany are all modeled as relations. You can get them (and a lot more) with a call like

http://overpass-api.de/api/interpreter?data=(rel[admin_level="4"](47,6,55,15););out;

Unfortunately, Germany doesn't fit very well into a single bounding box. For that reason you get a lot of other states into the result.

The cities are more difficult. There is no reliable tagging of the number of inhabitants. It is a number that changes anyway every day, and tends to g. For example, the number of cities with more than 100,000 inhabitants is now probably closer to 90 than to 80.

A more stable criterion are the "Kreisfreie Städte": these are cities big enough to have the administrative rank of a county. You can find them with

http://overpass-api.de/api/interpreter?data=(rel[admin_level="6"]["de:place"="city"];);out;

permanent link

answered 29 Jun '12, 16:25

Roland%20Olbricht's gravatar image

Roland Olbricht
6.4k35986
accept rate: 35%

edited 29 Jun '12, 16:26

0

About the states:
- a state can be modeled in OSM by its boundaries (a way tagged with boundary=administrative + a relation of type=multipolygon (or type=boundary in other countries) + admin_level=4. Or it can be represented by a node of the state capital. You can have both which is the case for German states. See for instance the state "Baden-Wuerttemberg" in the OSM wiki, its relation and its capital "Stuttgart as a node tagged place=city + capital=4". Note that the capital node belongs to the state relation with the role "admin_centre". So, check the type of objects representing features (nodes or ways or relations) and the tagging practices in OSM BEFORE you think about building a query string to Overpass_API.

About the cities:
- the categorization of a place, between "city" or "town", can be country specific. The wiki about German cities suggests that places with more than 100.000 inhabitants has to be classified as "city". Then the question now is to verify if the 144 German cities in OSM are really >100.000 hab. or if the wikipedia definition of a "city" is different than the OSM definition (the population threshold might be different or other criterium might be involved).

permanent link

answered 28 Jun '12, 16:27

Pieren's gravatar image

Pieren
9.7k2075157
accept rate: 15%

edited 28 Jun '12, 16:27

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:

×377
×294
×32
×22
×12

question asked: 28 Jun '12, 10:39

question was seen: 12,153 times

last updated: 29 Jun '12, 16:26

powered by OSQA