[GIS] Openstreetmap Nominatim web service API – Result language

nominatimopenstreetmapreverse-geocoding

I notices something strange:

When I execute simple request:

https://nominatim.openstreetmap.org/reverse?format=xml&lat=45&lon=10&zoom=18&addressdetails=0

From the PC web browser for location located in my country (not 45/10) I get the result in English, although we have different language here.

But when I execute the very same request, without any other data like headers from application running on a mobile device – I do get the result in our local language.

Why this is happen? I familiar with the accept-language param of Nominatim, but as seen – I'm not specify him nor touching headers in my request.

Best Answer

Your browser and other HTTP/HTTPS clients will sent an Accept-Language field in the HTTP request header. This can for example look like:

Accept-Language: de-DE,de;q=0.8,en-US;q=0.5,en;q=0.3\r\n

Which means: prefer German (de-DE or de) with an quality value of 0.8, then US-English (en-US) with an quality value of 0.5 (i.e. lower than German), then English (en) with an quality value of 0.3) (i.e. lower than German and US-English). Most browser will always sent this field in their requests, the preferred languages can be configured via your browser settings.

The accept-language parameter for Nominatim overrides the Accept-Language field of the HTTP request allowing you to request results in a language different to your browser settings.

Related Question