aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/geocoder/FactualGeocoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-02-15 22:01:58 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-02-15 22:01:58 -0800
commitd199eb36f3b70d80f0a2cffead5777c7998c4e31 (patch)
tree13e5d44104200c5d3fb5af9fc7a22bc41724bec3 /src/main/java/org/traccar/geocoder/FactualGeocoder.java
parentb6fe2bd75a3541d6fe63a6b6161ed04b773e37a6 (diff)
downloadtrackermap-server-d199eb36f3b70d80f0a2cffead5777c7998c4e31.tar.gz
trackermap-server-d199eb36f3b70d80f0a2cffead5777c7998c4e31.tar.bz2
trackermap-server-d199eb36f3b70d80f0a2cffead5777c7998c4e31.zip
Provide default URLs
Diffstat (limited to 'src/main/java/org/traccar/geocoder/FactualGeocoder.java')
-rw-r--r--src/main/java/org/traccar/geocoder/FactualGeocoder.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/geocoder/FactualGeocoder.java b/src/main/java/org/traccar/geocoder/FactualGeocoder.java
index c7a68c293..f540eb8fe 100644
--- a/src/main/java/org/traccar/geocoder/FactualGeocoder.java
+++ b/src/main/java/org/traccar/geocoder/FactualGeocoder.java
@@ -1,6 +1,6 @@
/*
* Copyright 2014 - 2015 Stefaan Van Dooren (stefaan.vandooren@gmail.com)
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,16 @@ import javax.json.JsonObject;
public class FactualGeocoder extends JsonGeocoder {
+ private static String formatUrl(String url, String key) {
+ if (url == null) {
+ url = "https://api.factual.com/geotag";
+ }
+ url += "?latitude=%f&longitude=%f&KEY=" + key;
+ return url;
+ }
+
public FactualGeocoder(String url, String key, int cacheSize, AddressFormat addressFormat) {
- super(url + "?latitude=%f&longitude=%f&KEY=" + key, cacheSize, addressFormat);
+ super(formatUrl(url, key), cacheSize, addressFormat);
}
@Override