Hello,

I'm here from a project where we need structured geodata. For this, I found the Overpass API, which seems to do exactly what we need.

The Reason for this is that OpenGeoDB is currently offline, and we want to cover a wider area than what we currently have.

We basically need the name, zip code and coordinates of all cities, towns and villages of a country. So very similar to what OpenGeoDB offered.

Unfortunately I'm not that into the complex topic of OSM data and the Overpass API and I think you guys here know a lot better about it :)

Can you help me to build an Overpass API query that can provide this data?

With kind regards Lena

asked 26 Nov '21, 09:52

Feuerhamster's gravatar image

Feuerhamster
11112
accept rate: 0%


Trying to do this with the publicly available Overpass API is going to be a painful road paved with lots of timeouts. (Painful for you and the server.) So don't do it. Instead, take the OpenStreetMap data for your country of interest (eg from download.geofabrik.de) and then either filter out the "place nodes" with a tool like osmium or osmfilter, or load the while file into a PostGIS database with the osm2pgsql tool and then run SQL queries to your heart's content.

Zip codes is going to be a problem, they will only be available for very few countries and they are not usually linked directly to a place (since the same place can have 1, 10, or 100 zip codes). If the country you are looking at has good coverage of post code polygons then you can use the database approach to find out which post code polygon a place is in. If not, you can sometimes at least "guess" by looking at some individual addresses near the centre of the place.

Do not assume that you can simply get from OSM what you previously got from OpenGeoDB without spending a few days on it. As far as I know, OpenGeoDB also has a hierarchy that lets you see which city is in which county is in which state and so on, something that you will have to compute yourself when working with OSM.

permanent link

answered 26 Nov '21, 10:21

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
80.5k907081244
accept rate: 23%

Sorry not to answer you question, but you might want to look at wikidata instead of OSM for this kind of queries.

permanent link

answered 26 Nov '21, 14:54

H_mlet's gravatar image

H_mlet
4.6k1571
accept rate: 13%

Your answer
toggle preview

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:

×225
×83
×64

question asked: 26 Nov '21, 09:52

question was seen: 635 times

last updated: 26 Nov '21, 14:54

powered by OSQA