Geocode with Bing?

Dan F2 years ago

I've tried Google which works fine.
I'd like to change to bing but can't get it working.

Is this the correct geocoder.type for bing? I've also tried Bing Maps

<entry key='geocoder.enable'>true</entry>
<entry key='geocoder.type'>bing</entry>
<entry key='geocoder.key'>MY BING API KEY</entry>
Anton Tananaev2 years ago

The type should be bingmaps.

Dan F2 years ago

Thanks, but It still won't work with Bing, but Google is fine.
With Bing, if I try clicking 'show address' it says:

URI is not absolute - IllegalArgumentException (... < JsonGeocoder:118 < ServerResource:61 < ...)

Here is the log error:

WARN: Geocoding failed - URI is not absolute - IllegalArgumentException (...)

and my conf with API crossed out.

    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>bingmaps</entry>
    <entry key='geocoder.key'>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</entry>

Do I need a <entry key='geocoder.url'> for Bing? Didn't think so and no idea where to find it if so.

Thanks Anton

Dan F2 years ago

I've added this to my conf:

<entry key='geocoder.url'>http://dev.virtualearth.net/REST/v1/Locations/</entry>

Which has moved me closer I think, but the address now shows:

'Grand Est, FR' - Which is odd because I'm in the UK. I've checked the coordinates from my tracker and they point to my house, so why it shows this I do not know.

I've tried formatting the address with this which makes no difference, but why should it when the address is wrong anyway.

<entry key='geocoder.format'> %h %r, %t, %s, %c</entry>
Dan F2 years ago

Okay so I've given up with Bing, I couldn't get it working properly.
So I've moved to LocationIQ, but I'm having an issue with that too.
I have set it up according to Traccar Documentation and it returns the address properly except the house number is always missing.
I've tried formatting which doesn't help.

My Conf:

    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>nominatim</entry>
    <entry key='geocoder.url'>https://eu1.locationiq.com/v1/reverse.php</entry>
    <entry key='geocoder.key'>myapikey</entry>

Does anyone have LocationIQ working with house numbers?

Thanks

Anton Tananaev2 years ago

LocationIQ uses OSM with some additional data. They only have house numbers in certain areas, as far as I know.

Dan F2 years ago

Okay thank you.
I'd like to use bing still as it has a reasonable free offering and it seems as accurate as Google geocoding in my experience.
I have a script for Bing Reverse Geocode works perfect, I think the formatting for the url may be wrong in Traccar.

This is the script url:

 Dim URLString As String = "http://dev.virtualearth.net/REST/v1/Locations/" & LatLong & "?o=xml&key=" & APIKey
Anton Tananaev2 years ago

Try this URL for Bing:

<entry key='geocoder.url'>http://dev.virtualearth.net/REST/v1</entry>
Dan F2 years ago

lol
I just this minute looked at the source file and realized that the code is already putting in the /locations/ part of the url, so I entered the url without that part and it works. So yes, you are right that is the correct url.

super(url + "/Locations/%f,%f?key=" + key + "&include=ciso2", cacheSize, addressFormat);

Maybe the /locations/ part could be removed in a future update to save confusion ?

Anyway, thank you, all working great.

Anton Tananaev2 years ago

Feel free to send a pull request.