diff options
Diffstat (limited to 'src/main/java/org/traccar/geocoder')
-rw-r--r-- | src/main/java/org/traccar/geocoder/GoogleGeocoder.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/geocoder/GoogleGeocoder.java b/src/main/java/org/traccar/geocoder/GoogleGeocoder.java index 93f128b46..40951742f 100644 --- a/src/main/java/org/traccar/geocoder/GoogleGeocoder.java +++ b/src/main/java/org/traccar/geocoder/GoogleGeocoder.java @@ -22,8 +22,10 @@ import jakarta.ws.rs.client.Client; public class GoogleGeocoder extends JsonGeocoder { - private static String formatUrl(String key, String language) { - String url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f"; + private static String formatUrl(String url, String key, String language) { + if (url == null) { + url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f"; + } if (key != null) { url += "&key=" + key; } @@ -33,8 +35,8 @@ public class GoogleGeocoder extends JsonGeocoder { return url; } - public GoogleGeocoder(Client client, String key, String language, int cacheSize, AddressFormat addressFormat) { - super(client, formatUrl(key, language), cacheSize, addressFormat); + public GoogleGeocoder(Client client, String url, String key, String language, int cacheSize, AddressFormat addressFormat) { + super(client, formatUrl(url, key, language), cacheSize, addressFormat); } @Override |