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

When performing a reverse geocode in nominatim the response consists of address jsonObject, are the keys in this json ordered based on the address hierarchy ?

Eg: http://nominatim.openstreetmap.org/reverse?format=json&limit=1&lat=12.8441574&lon=80.0599055

This responds with display name : "display_name":"D3 Guduvancheri Police Station, Grand Southern Trunk Road, Guduvancheri, Potheri, Kanchipuram district, Tamil Nadu, 603202, India"

The address json is : "address":{"police":"D3 Guduvancheri Police Station","road":"Grand Southern Trunk Road","suburb":"Guduvancheri","village":"Potheri","state_district":"Kanchipuram district","state":"Tamil Nadu","postcode":"603202","country":"India","country_code":"in"}

I see the order is preserved. I wanted to know if this can be assumed to work with any input, i.e is this the intended way?

Thanks in advance for any help!

asked 11 May '17, 14:50

Arun%20Gowtham's gravatar image

Arun Gowtham
0111114
accept rate: 0%


It's more coincidence since PHP's hash table implementation keeps the order of elements when inserted (http://nikic.github.io/2014/12/22/PHPs-new-hashtable-implementation.html) and not guaranteed.

If you want to order the elements you can have a look at this list of keys https://github.com/OpenCageData/address-formatting/blob/master/conf/components.yaml (where anything not in the list should go in the first position)

permanent link

answered 11 May '17, 15:42

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Your answer
toggle preview

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

question asked: 11 May '17, 14:50

question was seen: 2,031 times

last updated: 11 May '17, 15:42

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