This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

how to convert reverse goecode result to english ?

0

My reverse geocode result contains some of sinhalese language. I want to get rid of that and want completely English result to be dispalyed. how should that be done?

asked 10 Jun '19, 10:58

charuUmesh's gravatar image

charuUmesh
11112
accept rate: 0%

edited 10 Jun '19, 10:59


One Answer:

2

Add &accept-language=en to the API request URL.

By default Nominatim returns the value of the name tag, e.g. for https://www.openstreetmap.org/relation/5337946 that is මාතර දිස්ත්‍රික්කය. If you set &accept-language=en then Nominatim first looks at the name:en tag.

https://nominatim.openstreetmap.org/reverse.php?format=json&lat=5.973857676873632&lon=80.54088463153965

"address": { "suburb": "Welegoda", "state_district": "මාතර දිස්ත්‍රික්කය", "state": "දකුණු පළාත", "postcode": "81050", "country": "ශ්‍රී ලංකාව இலங்கை", "country_code": "lk" },

https://nominatim.openstreetmap.org/reverse.php?format=json&lat=5.973857676873632&lon=80.54088463153965&accept-language=en

"address": { "suburb": "Welegoda", "state_district": "Matara District", "state": "Southern Province", "postcode": "81050", "country": "Sri Lanka", "country_code": "lk" },

answered 10 Jun '19, 11:58

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Source code available on GitHub .