diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/Context.java | 6 | ||||
-rw-r--r-- | src/org/traccar/geocode/NominatimReverseGeocoder.java | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 2cd1beecc..2b8860187 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -192,7 +192,11 @@ public final class Context { int cacheSize = config.getInteger("geocoder.cacheSize"); switch (type) { case "nominatim": - reverseGeocoder = new NominatimReverseGeocoder(url, cacheSize); + if (key != null) { + reverseGeocoder = new NominatimReverseGeocoder(url, key, cacheSize); + } else { + reverseGeocoder = new NominatimReverseGeocoder(url, cacheSize); + } break; case "gisgraphy": reverseGeocoder = new GisgraphyReverseGeocoder(url, cacheSize); diff --git a/src/org/traccar/geocode/NominatimReverseGeocoder.java b/src/org/traccar/geocode/NominatimReverseGeocoder.java index 0fbeaef83..b393f6490 100644 --- a/src/org/traccar/geocode/NominatimReverseGeocoder.java +++ b/src/org/traccar/geocode/NominatimReverseGeocoder.java @@ -27,6 +27,10 @@ public class NominatimReverseGeocoder extends JsonReverseGeocoder { super(url + "?format=json&lat=%f&lon=%f&zoom=18&addressdetails=1", cacheSize); } + public NominatimReverseGeocoder(String url, String key, int cacheSize) { + super(url + "?format=json&lat=%f&lon=%f&zoom=18&addressdetails=1&key=" + key, cacheSize); + } + @Override public Address parseAddress(JsonObject json) { JsonObject result = json.getJsonObject("address"); |