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

Best way to get all cities of a specific area?

1

I'm just starting to play with the databases (Nominatim, Mapnik), but I'm a little bit confused about such an easy task: "How to get a list of all cities in Germany?"

Nominatim: It could be so easy, but of course it is not. If I search all states of Germany, I get a only 13 back (of 16!). Why? Because the others do have "Deutschland" instead of "Germany" in their "isin"-column or just nothing.

Mapnik: I suppose the "savest" way would be to find all city-Points inside the "Germany"-polygon? But I can't even find the Germany-polygon. I only found the Germany-point. How do I do this?

Or am I doing it totally wrong? What would be your approach?

asked 27 Apr '12, 12:10

np00's gravatar image

np00
51448
accept rate: 0%

edited 27 Apr '12, 12:11


One Answer:

3

Several possible approaches:

  1. Import data into database then make queries, like you tried.
  2. Don't import data but instead use someone else's database - see XAPI or Overpass. (The latter can indeed limit a search to a boundary polygon, and an easy way of finding the Germany relation is typing "openstreetmap relation germany" into Google.)
  3. Don't use a database at all; download a suitable extract (e.g. from download.geofabrik.de), cut out an area if required using osmosis or similar (not required if you want all of Germany since there's already an extract for that), and then use osmosis or osmfilter to extract the objects you need.

answered 27 Apr '12, 12:20

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Because I'm planning to get used to the databases, I will focus on the first approach.

Is my assumtion for the mapnik-database true? Could you help/lead me with that?

Thanks for the quick response!

(27 Apr '12, 12:30) np00
2

Mapnik is out of point here. Mapnik is the software used for rendering the data from a postgis database. You need to import the OSM data in a postgis database.

(03 May '12, 09:41) NicolasDumoulin

Source code available on GitHub .