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


I'm looking for a way to extract a list of all places (cites, towns and so on) with their respective admin boundary ISO codes. Is there a way to do it with whatever tool is available?

The issue I'm working around is this:

  1. Some places might be represented by areas, some by nodes. While I need all places to be nodes, with their respective lat/lon values.
  2. Relationship between cities and their admin boundaries are not standartized across all countries in the OSM file.

What's the best to tackle this problem?

Do you think it's possible to achieve a 100% accuracy for this particular data in question, considering the today's state of the OSM file.

asked 03 Jul '17, 23:17

meglio's gravatar image

accept rate: 0%

You tackle this problem not by asking one question after another here hoping others will do all the work for you, but by sitting down and creating a solution yourself. Try out those things others have told you in your other questions and play around with it. You have looked at the data already, good! Now try out solutions. When you have tried something, come back with more specific question.

Nobody ever has 100% accuracy. Only you know what you want to use this data for so only you can decide what level of accuracy you actually need and where you are willing to make compromises.

permanent link

answered 04 Jul '17, 07:00

Jochen%20Topf's gravatar image

Jochen Topf
accept rate: 31%


To answer your last question first, there will certainly not be 100% accuracy nor completeness. This starts with the question of "what is a city's respective admin boundary"! For many countries you will not even have all city nodes, much less admin boundaries on the municipal level.

If I were asked to generate this data set, I would

  1. import planet into osm2pgql (possibly with a reduced dataset like you asked about earlier)
  2. where there are polygons with a place=city tag, compute a point on surface (not centroid)
  3. for each place=city node and each node found in step 2, find the smallest enclosing admin boundary of admin_level 8 or smaller; if that admin boundary is not of admin_level 8 (but smaller) then ensure that no other place=city nodes are in the same area (else drop it)
  4. de-duplicate the list created in step 3 since step 2 might have introduced a place=city node that was already there
permanent link

answered 04 Jul '17, 06:54

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

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: 03 Jul '17, 23:17

question was seen: 2,282 times

last updated: 04 Jul '17, 07:00

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