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

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 and

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:[bbox=5.87,47.27,15.04,55.12][type=administrative]

To fetch list of cities in Germany I am using this query:[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
accept rate: 0%

The states of Germany are all modeled as relations. You can get them (and a lot more) with a call like[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[admin_level="6"]["de:place"="city"];);out;

permanent link

answered 29 Jun '12, 16:25

Roland%20Olbricht's gravatar image

Roland Olbricht
accept rate: 36%

edited 29 Jun '12, 16:26

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

accept rate: 15%

edited 28 Jun '12, 16:27

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 28 Jun '12, 10:39

question was seen: 18,435 times

last updated: 29 Jun '12, 16:26

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