How to customize / format the Reverse Geocode Data ?

Wim4 years ago

Hi Anton, when i start a geocode request from LocationIQ i get back an answer like this :
{ "place_id": "66773146", "licence": "https://locationiq.com/attribution", "osm_type": "node", "osm_id": "5643775388", "lat": "52.5167093", "lon": "13.3886277", "display_name": "35, Unter den Linden, Spandauer Vorstadt, Mitte, Berlin, 10117, Deutschland", "address": { "house_number": "35", "road": "Unter den Linden", "neighbourhood": "Spandauer Vorstadt", "suburb": "Mitte", "city_district": "Mitte", "city": "Berlin", "state": "Berlin", "postcode": "10117", "country": "Deutschland", "country_code": "de" }, "boundingbox": [ "52.5166093", "52.5168093", "13.3885277", "13.3887277" ]}

When i have a look to my trips-summary or any other address-field i see the following :
35 Unter den Linden, Mitte, Berlin, DE or
house_number road, city_district, state, Uppercase from country_code

But in german it should be :
Unter den Linden 35, 10117 Berlin, Berlin, Deutschland or
road house_number, postcode city, country, state

How can i customize / format this string ?

thx in forward
Wim

Anton Tananaev4 years ago

There's a documentation for it:

https://www.traccar.org/configuration-file/

Wim4 years ago

Hi Anton,
i think for LocationIQ the city is missing,
i get :
%d - district --> OK
%t - settlement (town) --> NOT OK, i get settlement but NOT city
%u - suburb --> OK

Anton Tananaev4 years ago

Can you please clarify what you mean. And provide some examples.

Wim4 years ago

Hi Anton, for example
<entry key='geocoder.format'>%r %h, %p %t %u, %s, %c</entry> gives that output
"Kleiststraße 11, 45472 Raadt Heißen, North Rhine-Westphalia, DE" but it must be
"Kleiststraße 11, 45472 Mülheim an der Ruhr Heißen, North Rhine-Westphalia, DE"
So the town (Mülheim an der Ruhr) is missing, instead the village "Raadt" is given, Heißen is the suburb ok

you may have a look here : Lat 51.428540° Lon 6.937837°
https://eu1.locationiq.com/v1/reverse.php?key=169a2799d68aa0&lat=51.428540&lon=6.937837&format=json
you get
{ "place_id": "125676778", "licence": "https://locationiq.com/attribution", "osm_type": "way", "osm_id": "166531408", "lat": "51.42865525", "lon": "6.93792233693483", "display_name": "11, Kleiststraße, Fulerum, Heißen, Rechtsruhr-Süd, Raadt, Mülheim an der Ruhr, Nordrhein-Westfalen, 45472, Deutschland", "address": { "house_number": "11", "road": "Kleiststraße", "neighbourhood": "Fulerum", "suburb": "Heißen", "city_district": "Rechtsruhr-Süd", "village": "Raadt", "city": "Mülheim an der Ruhr", "state": "Nordrhein-Westfalen", "postcode": "45472", "country": "Deutschland", "country_code": "de" }, "boundingbox": [ "51.4285752", "51.4287475", "6.9378313", "6.938039" ]}

thx & kr Wim

Anton Tananaev4 years ago

You can use full formatted address option if it doesn't work otherwise.

Wim4 years ago

Hi Anton, in %f the formatting is not correct