aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocoder/NominatimGeocoder.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/NominatimGeocoder.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/NominatimGeocoder.java')
-rw-r--r--src/org/traccar/geocoder/NominatimGeocoder.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/org/traccar/geocoder/NominatimGeocoder.java b/src/org/traccar/geocoder/NominatimGeocoder.java
index b0ee39c6a..c10a1414e 100644
--- a/src/org/traccar/geocoder/NominatimGeocoder.java
+++ b/src/org/traccar/geocoder/NominatimGeocoder.java
@@ -19,16 +19,18 @@ import javax.json.JsonObject;
public class NominatimGeocoder extends JsonGeocoder {
- public NominatimGeocoder() {
- this("http://nominatim.openstreetmap.org/reverse", 0);
- }
-
- public NominatimGeocoder(String url, int cacheSize) {
- super(url + "?format=json&lat=%f&lon=%f&zoom=18&addressdetails=1", cacheSize);
+ private static String formatUrl(String url, String key) {
+ if (url == null) {
+ url = "http://nominatim.openstreetmap.org/reverse";
+ }
+ if (key != null) {
+ url += "&key=" + key;
+ }
+ return url;
}
public NominatimGeocoder(String url, String key, int cacheSize) {
- super(url + "?format=json&lat=%f&lon=%f&zoom=18&addressdetails=1&key=" + key, cacheSize);
+ super(formatUrl(url, key), cacheSize);
}
@Override