aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocoder/GoogleGeocoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-15 20:31:52 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-15 20:31:52 +1300
commited44b99c9decb2f56df821d642bbc511e7d90eaa (patch)
tree2c17aa7a2f799812523075f33456f84f4c9825f9 /src/org/traccar/geocoder/GoogleGeocoder.java
parent6ed2b3884d36ab133d9501983cd00bbe46fe4393 (diff)
downloadtrackermap-server-ed44b99c9decb2f56df821d642bbc511e7d90eaa.tar.gz
trackermap-server-ed44b99c9decb2f56df821d642bbc511e7d90eaa.tar.bz2
trackermap-server-ed44b99c9decb2f56df821d642bbc511e7d90eaa.zip
Support language for Google geocoder
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