I am trying to get city name from reverse geocoding. Problem is for some geo location it is showing city name but for some it is other details like county, suburb. It is hard for me to use the data as it is changing place to place.

Here is the example.




If you check the output of above links then you can see the difference.

Is there any way I can get the Country Name, Zip code, and City name properly.


asked 02 May '18, 21:04

Raja07848's gravatar image

accept rate: 0%


The example in Denmark isn't in a city, so I think you can't expect a city name there at least.

(03 May '18, 10:50) Hjart

That's not possible with Nominatim. The hierarchies in different countries sometimes skip a level (think small countries that don't have states), some countries don't have postal code systems, there's villages without cities (administered by a county instead), etc. On top the underlying OpenStreetMap data might simply be lacking information, or links between places (if the boundary of a city isn't known then it's more or less guessing if a nearby village belongs to the city or not). Your best chance is to treat postal codes as optional. And if a city is not returned choose the country/state/district or even country.

permanent link

answered 03 May '18, 12:59

mtmail's gravatar image

accept rate: 31%

Your answer
toggle preview

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](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:


question asked: 02 May '18, 21:04

question was seen: 1,749 times

last updated: 03 May '18, 12:59

powered by OSQA