owntracks / recorder

Store and access data published by OwnTracks apps
Other
894 stars 123 forks source link

Reverse geocode #424

Closed ippocratis closed 1 year ago

ippocratis commented 1 year ago

I need some clarification regarding reverse recoding. As far as I can tell reading the bootleg there is reverse geocoding on the mobile app under preferenes>advanced>provider and the its api key. This is used to display street names for the devices in the map view. I got that working fine using opencage as provider.

What I cant make to work is the server side (recorder) reverse Geocoding. I run owntracks recorder with docker and I have my recorder.conf under the config folder

volumes:
            - ./config:/config

Added my geokey there:

OTR_GEOKEY = "opencage:xxxxxxccccccccccc"

and also tried to add it directly in the recorder enviroment in the compose file:

environment:
            - OTR_GEOKEY = "opencage:xxxxxxxxxxxxxxxxx"

Accesing the recorder ui in the last endpoint https://recorder.example.com/last/index.html

Or the points andpoint

https://recorder.example.com/map/index.html?from=2023-10-08T23:11:17.550Z&to=2023-10-09T11:11:17.549Z&format=geojson&user=xx&device=xx

Still displays coordinates instead of street names

Shouldn't the recorder's web ui be capable to display reverse gecoded data?

More than that, looking at my LMDB dB with

docker exec -it 2-otrecorder-1 ocat --dump

Returns something like

friends
keys
luadb                                                   
sr3n24c {}
sw1x4wx {}                                              
sw1x54j {}
.
.
.
.
.
etc

Looks like my Geohash strings are empty(?)

Shouldn't these contain reverse geocahe data?

https://github.com/owntracks/recorder#the-geo-cache

Thanks

jpmens commented 1 year ago

Accesing the recorder UI at the last endpoint should indeed show reverse geocodes when clicking on the pins, and I think you've set everything up correctly.

It would appear as though your container cannot access the OpenCage API URL (compiled into the Recorder https://github.com/owntracks/recorder/blob/78b539d2357703b4fb1031d3c8ff4f5c4462105e/geo.c#L38 ).

Can you see if you can provide the stdout/stderr logs the Recorder shows when running? There might be some indication there.

ippocratis commented 1 year ago

@jpmens

Looks like I had to add the opencage api key to the entrypoint.sh and rebuild the Dockerfile to update the image in order to get the reverse geocode start working

Another users issue and your comments there pointed me to the right direction.

Maybe this somehow have to be documented in the docker-recorder repo?

jpmens commented 1 year ago

This should not have been necessary. Looking at a current image:

$ docker run -it --entrypoint /usr/sbin/ot-recorder owntracks/recorder -V |  grep GEOKEY
OTR_GEOKEY                <null>

the OTR_GEOKEY value is indeed NULL as expected.

However, if I launch the image with the environment variable set, it's actually used within the container (unless overwritten by a config file):

$ docker run -it --entrypoint /usr/sbin/ot-recorder -e OTR_GEOKEY="opencage:xxxxxxxxxxxxxxxxx" owntracks/recorder -V | grep GEOKEY
OTR_GEOKEY                opencage:xxxxxxxxxxxxxxxxx