GeoCoder Format Suburb

JLS GPS6 years ago

I am using my own nominatim server and its returning the result below.

https://nominatim.openstreetmap.org/reverse.php?format=json&lat=40.641117&lon=-73.984020&zoom=18&addressdetails=1

{  
   "place_id":"26635555",
   "licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
   "osm_type":"node",
   "osm_id":"2561966388",
   "lat":"40.6414198",
   "lon":"-73.9843821",
   "display_name":"1301, 37th Street, Parkville, Brooklyn, Kings County, New York City, New York, 11218, USA",
   "address":{  
      "house_number":"1301",
      "road":"37th Street",
      "neighbourhood":"Parkville",
      "suburb":"Brooklyn",
      "county":"Kings County",
      "city":"New York City",
      "state":"New York",
      "postcode":"11218",
      "country":"USA",
      "country_code":"us"
   },
   "boundingbox":[  
      "40.6413198",
      "40.6415198",
      "-73.9844821",
      "-73.9842821"
   ]
}

But when the suburb comes in to the address column, instead of Brooklyn it only show BK. Why?

Anton Tananaev6 years ago

I don't see BK anywhere in the response.

JLS GPS6 years ago

Thats my question. In the positions table it does come in as BK

Distance

0.00 km
Address

1301 37th Street, BK, 11218

Anton Tananaev6 years ago

All address components are coming from JSON response. It means that response is different from what you provided.

JLS GPS6 years ago

Why would it return different when called from traccar? Do you send anything else than this URL?

Anton Tananaev6 years ago

Good question. I don't think it sends anything else.

JLS GPS6 years ago

Figured it out. Depends if you send accept-language=en or accept-language=EN.

How can we set what traccar sends in language?

JLS GPS6 years ago
Anton Tananaev6 years ago

You can set "geocoder.language" parameter in the config. It will include that value as a query parameter.

Anton Tananaev6 years ago

It uses "language", not "accept-language" though.

JLS GPS6 years ago

Thanks. Works great.

<entry key='geocoder.language'>en</entry>

I see in the source code

        if (language != null) {
            url += "&accept-language=" + language;
}

Thanks again for this wonderful product.