Reverse Geocoding issue

hariro 2 days ago
<entry key="geocoder.enable">true</entry>
<entry key="geocoder.type">nominatim</entry>
<entry key="geocoder.url">http://my server ip</entry>
<entry key="geocoder.onRequest">true</entry>
<entry key="geocoder.ignorePositions">true</entry>
<entry key="geocoder.reuseDistance">100</entry>

With this setting, the web UI and App UI will display coordinates instead of the Show Address button or caption.
If <entry key="geocoder.ignorePositions">false</entry> then the address will always be displayed. I would like the Show Address button/caption to be displayed. What should I do to prevent the coordinates from being displayed on the web UI?

Eric 2 days ago

I also don't get it. I have this in my compose file:

environment:
  CONFIG_USE_ENVIRONMENT_VARIABLES: "true"
  GEOCODER_ENABLE: TRUE
  GEOCODER_TYPE: nominatim
  GEOCODER_URL: http://192.168.1.200:3000/reverse
  GEOCODER_KEY: 3bd9b5d95df656244ecfa06698b1f5ac
  GEOCODER_ONREQUEST: "false"
  GEOCODER_IGNOREPOSITIONS: "false"

And still the "Positions" report doesn't display the address but the coordinates, also for newly reported positions.
In my case it doesn't matter what the last two environment variables are. The "Positions" report is always showing coordinates. If I press on the coordinates it's displaying the address. The "Trips" report is always displaying the address. So is Traccar even using the two environment variables???

I am for sure my traccar geocoder works because when I change the IP address it doesn't work anymore.

Eric 2 days ago

It's working:

Environment variables are not the same as the XML syntax!!!

  GEOCODER_ON_REQUEST: TRUE
  GEOCODER_IGNORE_POSITIONS: FALSE

Missing dots in documentation :-( :-(
So I was also missing the underscore too.

Please check documentation!

hariro 2 days ago

For me, if <entry key="geocoder.ignorePositions">false</entry> and the variable <entry key="geocoder.onRequest">true</entry> are present, reverse geocoding works.
But if <entry key="geocoder.ignorePositions">true</entry> , it writes coordinates that when clicked will display the address.
I don't understand why this is happening, it previously said it was displaying the address.

This is in the documentation here on the site.

Névtelen.jpg

Eric 2 days ago

Yes, that is true. But the Environment variables for the docker compose file are not the same as in the XML file.
geocoder.ignorePositions = GEOCODER_IGNORE_POSITIONS
geocoder.onRequest = GEOCODER_ON_REQUEST

This is very bad, so the documentation is wrong. It took me a few hours to find this!!!

Documentation -> "To convert config key to an environment variable key replace dots with underscore and convert the rest to screaming snake case."

Not for those 2 parameters!

hariro 2 days ago

If I understand correctly, since I'm running it in a docker container, it should look like this in the xml file?

<entry key="GEOCODER_ON_REQUEST">true</entry>
<entry key="GEOCODER_IGNORE_POSITIONS">false</entry>

Or you need to add it to the docker environment variables and delete it from the xlm file.

Eric 2 days ago

I'm not using the xml file. I don't do anything with it. It's the default xml file in the docker container. I use a docker compose file where I set all the parameters. The parameters in de xml file are still the same but not the same a the parameters in de docker compose file.

compose file:

services:

  database:
    image: mysql:8.4
    restart: unless-stopped
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
      MYSQL_DATABASE: traccar
      MYSQL_USER: xxx
      MYSQL_PASSWORD: xxx
    volumes:
      - /opt/traccar/data:/var/lib/mysql

  traccar:
    image: traccar/traccar:latest
    restart: unless-stopped
    depends_on:
      - database
    environment:
      CONFIG_USE_ENVIRONMENT_VARIABLES: "true"
      GEOCODER_ENABLE: TRUE
      GEOCODER_TYPE: nominatim
      GEOCODER_URL: http://192.168.1.200:3000/reverse
      GEOCODER_KEY: 3bdxxxxxxx6698b1f5ac
      GEOCODER_ON_REQUEST: TRUE
      GEOCODER_IGNORE_POSITIONS: FALSE
      DATABASE_DRIVER: com.mysql.cj.jdbc.Driver
      DATABASE_URL: >-
        jdbc:mysql://database:3306/traccar
        ?zeroDateTimeBehavior=round
        &serverTimezone=UTC
        &allowPublicKeyRetrieval=true
        &useSSL=false
        &allowMultiQueries=true
        &autoReconnect=true
        &useUnicode=yes
        &characterEncoding=UTF-8
        &sessionVariables=sql_mode=''
      DATABASE_USER: xxx
      DATABASE_PASSWORD: xxx
    healthcheck:
      test: [ "CMD", "wget", "-q", "--spider", "http://localhost:8082/api/health" ]
      interval: 2m
      timeout: 5s
      start_period: 1h
      retries: 3
    ports:
      - "8082:8082"
      - "5000-5500:5000-5500"
    volumes:
      - /opt/traccar/logs:/opt/traccar/logs

  autoheal:
    image: willfarrell/autoheal:latest
    restart: always
    environment:
      AUTOHEAL_CONTAINER_LABEL: all
      AUTOHEAL_INTERVAL: 60
      AUTOHEAL_START_PERIOD: 3600
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
hariro 2 days ago

Thank you. I'll try to include just these two variables, the xml file will be more transparent for me.

Anton Tananaev 2 days ago

I'll comment here just in case. The documentation is correct. It clearly mentions how to convert XML parameters to environment variables.

hariro 2 days ago

I understand what is written here are the environment variables, it has no effect, it still writes coordinates, if I click on coordinates it gives the address

     CONFIG_USE_ENVIRONMENT_VARIABLES: "true"
     GEOCODER_ENABLE: TRUE
     GEOCODER_TYPE: nominatim
     GEOCODER_URL: http://myserver ip8080/reverse.php
     GEOCODER_ON_REQUEST: TRUE
     GEOCODER_IGNORE_POSITIONS: FALSE
     GEOCODER_REUSE_DISTANCE: 100
Anton Tananaev 2 days ago

That's expected behavior on the new version. We display coordinates instead of the show address label, but it works the same way.

hariro 2 days ago

I understand, I didn't know that, thank you very much, this wasn't the case until now, then it performs the expected behavior in the case of the xml file as well.
Which version did it change from?