aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocoder/GoogleGeocoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/geocoder/GoogleGeocoder.java')
-rw-r--r--src/org/traccar/geocoder/GoogleGeocoder.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/org/traccar/geocoder/GoogleGeocoder.java b/src/org/traccar/geocoder/GoogleGeocoder.java
index 0506e701a..b38870c8f 100644
--- a/src/org/traccar/geocoder/GoogleGeocoder.java
+++ b/src/org/traccar/geocoder/GoogleGeocoder.java
@@ -21,16 +21,19 @@ import javax.json.JsonString;
public class GoogleGeocoder extends JsonGeocoder {
- public GoogleGeocoder() {
- this(0);
- }
-
- public GoogleGeocoder(int cacheSize) {
- super("http://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f", cacheSize);
+ private static String formatUrl(String key, String language) {
+ String url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f";
+ if (key != null) {
+ url += "&key=" + key;
+ }
+ if (language != null) {
+ url += "&language=" + language;
+ }
+ return url;
}
- public GoogleGeocoder(String key, int cacheSize) {
- super("https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&key=" + key, cacheSize);
+ public GoogleGeocoder(String key, String language, int cacheSize) {
+ super(formatUrl(key, language), cacheSize);
}
@Override