Living on a small island that doesnt always have street name and numbers makes Geocoding addresses a bit hit and miss.
Google has almost 3000 POI records with business names, etc. that I have managed to scrape and store in a database. I am using these for external Trip and Out of Hours reports to Geocode the Lat,Lon to the nearest POI and if more than 100m away, default to the Google Geocode location.
It is working really well and has made our external Trip report very useful for our customers, as they can relate to the POI rather than less used street addresses.
What I'd like to do now is to have the Traccar "Show Address" use my service rather than the current LocationIQ service.
I have added the following to my CONFIG
<entry key='geocoder.enable'>true</entry>
<entry key='geocoder.type'>locationiq</entry>
<entry key='geocoder.url'>https://traccar.ws/geocode/</entry>
My server logs show the URL being called with all of the GET parameters and I've have made the returned JSON emulate the LocationIQ JSON, but when I use the developer tools I see that it returns a 204 error (No content)
If you go to https://traccar.ws/geocode/?lat=-13.827668&lon=-171.804053
it returns the data with the JSON header
I know this isn't really the best way to do it, so is there another way to add a Geocode service?
Kev
The JSON format you return is incorrect. Make sure it matches what LocationIQ returns.
OK, got it working... I needed to cast the bounds as strings and it seems you use the optional address fields rather than the mandatory display_name.
{
"place_id": "1022950",
"license": "https://locationiq.com/attribution",
"lat": "-13.8327211",
"lon": "-171.7681519",
"display_name": "MotoSamoa Apia",
"address": {
"road": "MotoSamoa Apia",
"country": "Samoa",
"country_code": "ws"
},
"boundingbox": [
"-13.832756934218",
"-13.832656934218",
"-171.7682001703",
"-171.7681001703"
]
}
if I put <entry key='geocoder.ignorePositions'>false</entry>
in the config, does this mean that automatic reverse geocoding requests for all positions is enabled?
Thanks,
Kev
OK, why then do I still get the Show Address when I click on some devices. This device is parked right next to another that shows the address from my Geocode server, which I imagine is cached.
Kev

The link is shown when there's no address recorded. It probably means your geocoding service failed or returned empty result.
Living on a small island that doesnt always have street name and numbers makes Geocoding addresses a bit hit and miss.
Google has almost 3000 POI records with business names, etc. that I have managed to scrape and store in a database. I am using these for external Trip and Out of Hours reports to Geocode the Lat,Lon to the nearest POI and if more than 100m away, default to the Google Geocode location.
It is working really well and has made our external Trip report very useful for our customers, as they can relate to the POI rather than less used street addresses.
What I'd like to do now is to have the Traccar "Show Address" use my service rather than the current LocationIQ service.
I have added the following to my CONFIG
<entry key='geocoder.enable'>true</entry> <entry key='geocoder.type'>locationiq</entry> <entry key='geocoder.url'>https://traccar.ws/geocode/</entry>
My server logs show the URL being called with all of the GET parameters and I've have made the returned JSON emulate the LocationIQ JSON, but when I use the developer tools I see that it returns a 204 error (No content)
If you go to
https://traccar.ws/geocode/?lat=-13.827668&lon=-171.804053
it returns the data with the JSON headerI know this isn't really the best way to do it, so is there another way to add a Geocode service?
Kev