aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcardus <joaquim.cardeira@gmail.com>2020-01-20 19:29:54 +0000
committerjcardus <joaquim.cardeira@gmail.com>2020-01-20 19:29:54 +0000
commit0c49e826a765abeef3e2c9f4d25fbbab5af1b18b (patch)
tree160188152c479a30cf9b65f4a8433fab5c895280
parentdf740ef9d1f2c339f4ffb0bf96f4a418065c72c8 (diff)
downloadtraccar-server-0c49e826a765abeef3e2c9f4d25fbbab5af1b18b.tar.gz
traccar-server-0c49e826a765abeef3e2c9f4d25fbbab5af1b18b.tar.bz2
traccar-server-0c49e826a765abeef3e2c9f4d25fbbab5af1b18b.zip
here geocoder url config parameter
-rw-r--r--src/main/java/org/traccar/MainModule.java2
-rw-r--r--src/main/java/org/traccar/geocoder/HereGeocoder.java7
-rw-r--r--src/test/java/org/traccar/geocoder/GeocoderTest.java2
3 files changed, 5 insertions, 6 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..7f0598765 100644
--- a/src/main/java/org/traccar/geocoder/HereGeocoder.java
+++ b/src/main/java/org/traccar/geocoder/HereGeocoder.java
@@ -19,8 +19,7 @@ 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) {
url += "?mode=retrieveAddresses&maxresults=1";
url += "&prox=%f,%f,0";
url += "&app_id=" + id;
@@ -31,8 +30,8 @@ public class HereGeocoder extends JsonGeocoder {
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
diff --git a/src/test/java/org/traccar/geocoder/GeocoderTest.java b/src/test/java/org/traccar/geocoder/GeocoderTest.java
index 85d9bf62f..407779be8 100644
--- a/src/test/java/org/traccar/geocoder/GeocoderTest.java
+++ b/src/test/java/org/traccar/geocoder/GeocoderTest.java
@@ -73,7 +73,7 @@ public class GeocoderTest {
@Ignore
@Test
public void testHere() {
- Geocoder geocoder = new HereGeocoder("", "", null, 0, new AddressFormat());
+ Geocoder geocoder = new HereGeocoder("https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json", "", "", null, 0, new AddressFormat());
String address = geocoder.getAddress(48.8575, 2.2944, null);
assertEquals("6 Avenue Gustave Eiffel, Paris, Île-de-France, FRA", address);
}