0

Hi,

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.

https://nominatim.openstreetmap.org/reverse?lat=24.7040592&lon=77.10249019999999&format=json&json_callback=my_callback&extratags=1

https://nominatim.openstreetmap.org/reverse?format=json&lat=54.9824031826&lon=9.2833114795&zoom=10&extratags=1

https://nominatim.openstreetmap.org/reverse?lat=28.5113627&lon=77.2330641&format=json&json_callback=my_callback&extratags=1

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.

Thanks

asked 02 May '18, 21:04

Raja07848's gravatar image

Raja07848
11112
accept rate: 0%

1

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

One Answer:
2

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

mtmail
3.8k1059
accept rate: 30%

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:

×91
×74

question asked: 02 May '18, 21:04

question was seen: 1,634 times

last updated: 03 May '18, 12:59

powered by OSQA