NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hello all,

I'm trying to get value of the key "city" using latitude and longitude. But unfortunately, I'm not getting expected result most of the time.

For example, the following API is giving correct value of city ("Dhaka"): https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=23.7123823525915215&lon=90.4103022068739&zoom=18

On the other hand, this API is not giving any value of city, whereas both of the locations are from same city: https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=23.76615&lon=90.35673&zoom=18

Any suggestion on how to get more consistent result?

asked 20 May '18, 11:18

shamimabrishti's gravatar image

shamimabrishti
16112
accept rate: 0%


It's a data coverage issue in this case. The city of Dhaka is in OSM data https://www.openstreetmap.org/node/3442474911, but it doesn't have (administrative) boundaries, so Nominatim simply doesn't know how big it is. The center point of the city (that node) is too far away to make a guess. Somebody (that could be you, https://www.openstreetmap.org/fixthemap) needs to change the OSM data to add boundaries.

An alternative is to add 'is_in' tags https://wiki.openstreetmap.org/wiki/Key:is_in to the suburbs. So is_in:city=Dhaka to (1) Pisciculture Housing (2) Mohammadpur (3) Mohammadpur Future Town. I got the names of the nearby suburbs from https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=370027291

permanent link

answered 20 May '18, 21:28

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Thanks a lot @mtmail for your effort, it was really helpful. I'll work on your suggestion :)

(21 May '18, 09:29) shamimabrishti

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

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:

×689
×85

question asked: 20 May '18, 11:18

question was seen: 2,956 times

last updated: 21 May '18, 09:29

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum