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

How to find the nearest neighboring city with nominatim API

0

Is there a way to find the nearest neighboring city with nominatim API?

If so can anybody provide me with a working URL example?

Thank you for your help in advance

asked 02 Dec '21, 10:33

Pepijn%20Moesker's gravatar image

Pepijn Moesker
11223
accept rate: 0%


One Answer:

1

Use the zoom parameter, example:

https://nominatim.openstreetmap.org/ui/reverse.html?lat=52.114939&lon=4.31488&zoom=10

(The small red circle is the coordinate, the blue circle the found city).

What you can't do with Nominatim: define by city size, e.g. find the nearest city with population > 1 million..

answered 02 Dec '21, 11:27

Spiekerooger's gravatar image

Spiekerooger
3.1k22356
accept rate: 16%

edited 02 Dec '21, 11:29

@spiekerooger - I'm looking for the nearest alternative town. So for example my coordinates are in Amsterdam but then I like to get the nearest city outside Amsterdam, lets say Zaandam. Is there a way to accomplish that?

(13 Dec '21, 09:33) Pepijn Moesker

@Pepijn Moesker: That will not be doable with the Nominatim API. This alternative API here: http://geodb-cities-api.wirefreethought.com/docs/api/find-near-location will probably help you out, e.g. "GET /v1/geo/locations/+52.383333+4.9/nearbyCities?limit=5&offset=0&radius=100" has Zaandam as a result.

(13 Dec '21, 13:34) Spiekerooger

Source code available on GitHub .