Here reverse geocoder API v6 no longer supported, can Traccar migrate to Here API v7?

C5rokia year ago

I'm using the Here (reverse) geocoder in Traccar and I got a note that the API v6 (using an app id and app code) will no longer be supported after 31 December 2023 and I have to migrate to API v7 (using an apiKey)

Is it possible to adapt the src/main/java/org/traccar/geocoder/HereGeocoder.java to use the Here API v7?
I did some testing on the new Here API and the formatUrl should look like this (not tested in Traccar)

private static String formatUrl(String url, String key, String language) {
    if (url == null) {
           url = "https://revgeocode.search.hereapi.com/v1/revgeocode"
    }
    url += "?types=address&limit=1";
    url += "&at=%f,%f";
    url += "&apiKey=" + key;
    if (language != null) {
           url += "&language=" + language;
    }
    return url;
}
Anton Tananaeva year ago

Is the data format the same as before?

C5rokia year ago

Not entirely, but address is still the same structure structure:

V6: curl -X GET https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?mode=retrieveAddresses&maxresults=1&prox=51.43,5.18,0&app_id=xxx&app_code=xxx

{"Response":{"MetaInfo":{"Timestamp":"2023-11-09T14:11:20.798+0000","NextPageInformation":"2"},"View":[{"_type":"SearchResultsViewType","ViewId":0,"Result":[{"Relevance":1.0,"Distance":11.0,"MatchLevel":"street","MatchQuality":{"Country":1.0,"State":1.0,"County":1.0,"City":1.0,"PostalCode":1.0},"Location":{"LocationId":"NT_ZXLahTFgLo.0zOq5.gfMrC_l_1341714021_R","LocationType":"point","DisplayPosition":{"Latitude":51.4299017,"Longitude":5.179978},"MapView":{"TopLeft":{"Latitude":51.43037,"Longitude":5.17808},"BottomRight":{"Latitude":51.4289,"Longitude":5.18485}},"Address":{"Label":"5085 Esbeek, Nederland","Country":"NLD","State":"Noord-Brabant","County":"Hilvarenbeek","City":"Esbeek","PostalCode":"5085","AdditionalData":[{"value":"Nederland","key":"CountryName"},{"value":"Noord-Brabant","key":"StateName"},{"value":"Hilvarenbeek","key":"CountyName"}]},"MapReference":{"ReferenceId":"1341714021","Spot":0.72,"SideOfStreet":"right","CountryId":"23055544","StateId":"23055529","CountyId":"23055818","CityId":"20202906"}}}]}]}}

V7: curl -X GET https://revgeocode.search.hereapi.com/v1/revgeocode?types=address&limit=1&at=51.43,5.18&apiKey=xxx

{"items":[{"title":"Prins Hendriklaan, 5085 Esbeek, Nederland","id":"here:af:streetsection:3f-udW2HPI-ATmlPgl7XKA","resultType":"street","address":{"label":"Prins Hendriklaan, 5085 Esbeek, Nederland","countryCode":"NLD","countryName":"Nederland","stateCode":"NB","state":"Noord-Brabant","county":"Hilvarenbeek","city":"Esbeek","street":"Prins Hendriklaan","postalCode":"5085"},"position":{"lat":51.43091,"lng":5.173},"distance":496,"mapView":{"west":5.11619,"south":51.4284,"east":5.173,"north":51.44153}}]}
Anton Tananaeva year ago

Can you please link the announcement? What does it say specifically? We do support an API key with v6 currently.

C5rokia year ago

See https://intersolute.de/here-newsletter/end-of-life-of-location-services.html.

I got a mail from here.com

You may have already received reminder emails from our HERE Developer and Platform team to migrate your HERE Developer account to Platform.here.com.
We are reaching out in this email to follow up on our blog post where we announced the extension of end-of-life of our predecessor versions of HERE Location Services until December 31st, 2023.
We have identified that the following AppIDs are still using versions of HERE Location Services that are impacted by this end-of-life announcement.
...
Account ID: HERE-xxx
The following apps are using predecessor HERE APIs:
AppID xxx is using: HERE Geocoder API v6 - reverse geocoding

Anton Tananaeva year ago
C5rokia year ago

Pull request is looking good ;-)
I'll try it as soon as it is in the (preview or) release.
Thanks.