I've trying to find a way to use the OpenStreetMap API to get a list of all cities in a specific country with their longitude, latitude for an iOS app to develop.
However I been unable to do so. I've been trying to use the Overpass API but I just can'T find the right parameters to list all cities (and not just the top 1000 or so).
Does anyone know a way to do this that returns proper JSON?
Your query isn't (IMHO) a good one for an API, as your results are very sparse but need to run over all the data (no general indexing).
So get an OSM extact, filter it with osmosis and then do your own processing on the results.
Keep in mind, that a town can be modelled differently in OSM:
You might also want to have a look at nominatim for geocoding and the legal FAQ for distributing OSM data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With