diff options
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r-- | src/org/traccar/Context.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 0b74eacd0..707e6edb6 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -103,14 +103,18 @@ public class Context { } if (config.getBoolean("geocoder.enable")) { - String type = config.getString("geocoder.type"); + String type = config.getString("geocoder.type", "google"); String url = config.getString("geocoder.url"); - if (type != null && type.equals("nominatim")) { - reverseGeocoder = new NominatimReverseGeocoder(url); - } else if (type != null && type.equals("gisgraphy")) { - reverseGeocoder = new GisgraphyReverseGeocoder(url); - } else { - reverseGeocoder = new GoogleReverseGeocoder(); + switch (type) { + case "google": + reverseGeocoder = new GoogleReverseGeocoder(); + break; + case "nominatim": + reverseGeocoder = new NominatimReverseGeocoder(url); + break; + case "gisgraphy": + reverseGeocoder = new GisgraphyReverseGeocoder(url); + break; } } |