diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 2 | ||||
-rw-r--r-- | src/main/java/org/traccar/geocoder/HereGeocoder.java | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 9adea61b0..0957d9fe3 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -170,7 +170,7 @@ public class MainModule extends AbstractModule { case "ban": return new BanGeocoder(cacheSize, addressFormat); case "here": - return new HereGeocoder(id, key, language, cacheSize, addressFormat); + return new HereGeocoder(url, id, key, language, cacheSize, addressFormat); case "mapmyindia": return new MapmyIndiaGeocoder(url, key, cacheSize, addressFormat); default: diff --git a/src/main/java/org/traccar/geocoder/HereGeocoder.java b/src/main/java/org/traccar/geocoder/HereGeocoder.java index 756260b52..aaf11d74d 100644 --- a/src/main/java/org/traccar/geocoder/HereGeocoder.java +++ b/src/main/java/org/traccar/geocoder/HereGeocoder.java @@ -19,20 +19,24 @@ import javax.json.JsonObject; public class HereGeocoder extends JsonGeocoder { - private static String formatUrl(String id, String key, String language) { - String url = "https://reverse.geocoder.api.here.com/6.2/reversegeocode.json"; + private static String formatUrl(String url, String id, String key, String language) { + if (url == null) { + url = "https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json"; + } url += "?mode=retrieveAddresses&maxresults=1"; url += "&prox=%f,%f,0"; url += "&app_id=" + id; url += "&app_code=" + key; + url += "&apiKey=" + key; if (language != null) { url += "&language=" + language; } return url; } - public HereGeocoder(String id, String key, String language, int cacheSize, AddressFormat addressFormat) { - super(formatUrl(id, key, language), cacheSize, addressFormat); + public HereGeocoder( + String url, String id, String key, String language, int cacheSize, AddressFormat addressFormat) { + super(formatUrl(url, id, key, language), cacheSize, addressFormat); } @Override |