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
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

accept rate: 29%

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: 11 May '17, 14:50

question was seen: 1,275 times

last updated: 11 May '17, 15:42

powered by OSQA