aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/Context.java6
-rw-r--r--src/org/traccar/geocode/GoogleReverseGeocoder.java4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 55561b921..e87f78d20 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -148,7 +148,11 @@ public final class Context {
reverseGeocoder = new FactualReverseGeocoder(url, key, cacheSize);
break;
default:
- reverseGeocoder = new GoogleReverseGeocoder(cacheSize);
+ if (key != null) {
+ reverseGeocoder = new GoogleReverseGeocoder(key, cacheSize);
+ } else {
+ reverseGeocoder = new GoogleReverseGeocoder(cacheSize);
+ }
break;
}
}
diff --git a/src/org/traccar/geocode/GoogleReverseGeocoder.java b/src/org/traccar/geocode/GoogleReverseGeocoder.java
index f1c27c5d3..be863718b 100644
--- a/src/org/traccar/geocode/GoogleReverseGeocoder.java
+++ b/src/org/traccar/geocode/GoogleReverseGeocoder.java
@@ -29,6 +29,10 @@ public class GoogleReverseGeocoder extends JsonReverseGeocoder {
super("http://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f", cacheSize);
}
+ public GoogleReverseGeocoder(String key, int cacheSize) {
+ super("http://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&key=" + key, cacheSize);
+ }
+
@Override
public Address parseAddress(JsonObject json) {
JsonArray results = json.getJsonArray("results");