Search code examples
openstreetmapnominatim

How to find a city(ies) only with partial search?


I am using Nominatim OpenStreetMap API to find city/ cities which matches search phrase.

For example, wind should work like Wind% - not an exact match but it does not work. The second problem is not able to get a city/cities. It returns, administrative, town, county, recreational and etc.

The Nominatim documentation suggests using special words but there is no example.

https://nominatim.openstreetmap.org/?format=json&addressdetails=1&q=winds&format=json&limit=5

The above URL returns 5 places but not a single city. I want to search for cities only. I can use the following which is kind of helpful but it does not search for a partial phrase and returns a result only with exact matcth:

https://nominatim.openstreetmap.org/?format=json&addressdetails=1&city=windsor&format=json&limit=5

If instead of city=windsor I use city=wind it does not return data.


Solution

  • Unfortunately Nominatim doesn't support partial matches. But photon does.