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

Hi, so far, every query I did always returned the same value for the field "class" vs the field "addresstype" in the Json Response. Are they the same and for historical reason they are both present of there's any difference I should be aware of?

By the way, I'm in the process of documenting with OpenAPI the Nominatim endpoints, so the kind of answer I'm looking for is what I can actually put on the addresstype. For the class field I've written: "Key of the principal tag defining the object type"

asked 11 Sep '23, 15:22

MattCon's gravatar image

accept rate: 0%

[edited to include information from the disucssion that followed]

Some fields are documented at

For a point-of-internet like a bank, restaurant, office or an address the values of the 'class' and 'addresstype' are indeed the same. For places in the hierarchy, e.g. the village, city, county, state the 'addresstype' gets derived from the type and the rank (country=4, city=16, suburb=18 etc).

The logic can be found in the method 'get_label_tag' in (Python) Nominatim 3.x used PHP language so look for a 'ClassTypes.php' file. Nominatim 4.x has both Python and PHP so it depends on the server installation which language is used. If in doubt look at Python.

You should coordinate the effort on where two other users started in the past. Not sure why nobody finished.

permanent link

answered 11 Sep '23, 19:39

mtmail's gravatar image

accept rate: 27%

edited 20 Sep '23, 22:48

please correct me if I'm wrong, but I don't see the address_type field neither in JSON nor in JSONv2. For the field missing I went to the database schema, but I could not find anything about address_type.

(11 Sep '23, 20:16) MattCon

You wrote "value for the field "class" vs the field "addresstype" in the Json Response" Can you give an example where addresstype is returned? What version of Nominatim are you using or have you used?

(11 Sep '23, 21:02) mtmail

Please check this: curl --request GET \ --url ''

(13 Sep '23, 13:22) MattCon

This is the result (for other readers)

[ { "place_id": 272820811, "licence": "Data © OpenStreetMap contributors, ODbL 1.0.", "osm_type": "way", "osm_id": 90394480, "lat": "52.5487921", "lon": "-1.8164308339635031", "class": "building", "type": "residential", "place_rank": 30, "importance": 9.99999999995449e-06, "addresstype": "building", "name": "", "display_name": "135, Pilkington Avenue, Maney, Sutton Coldfield, Wylde Green, Birmingham, West Midlands Combined Authority, England, B72 1LH, United Kingdom", "boundingbox": [ "52.5487473", "52.5488481", "-1.8165130", "-1.8163464" ] } ]

(13 Sep '23, 13:24) MattCon

For a place_rank=30, e.g. shop, restaurant, bank it would indeed be the same. The logic is in get_label_tag in That's Python, Nominatim used to be written in PHP and there's a similar ClassTypes.php. uses Python frontend, while other local installed servers might still use the PHP frontend (

(13 Sep '23, 15:52) mtmail

In the future you should use instead of The former is legacy and might be removed in the future. format=jsonv2 is also usually better than format=json

(13 Sep '23, 15:53) mtmail

Now it's clear at least where the value comes from. Not so easy to explain in the documentation, tough. Thanks for the tip on the right url to use.

would you mind editing your answer for the future readers?

(13 Sep '23, 16:19) MattCon

Good idea since only the first 5 comments are shown by default. I edited the answer now.

(20 Sep '23, 22:49) mtmail
showing 5 of 8 show 3 more comments

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]( "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 Sep '23, 15:22

question was seen: 1,476 times

last updated: 20 Sep '23, 22:49

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