aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-03-24 14:40:58 -0700
committerGitHub <noreply@github.com>2022-03-24 14:40:58 -0700
commit80dd9eebab6cb90761d325852536395879d9412f (patch)
tree7704829173175d3053c9cbde3cb7db43580029ff /src/main/java/org/traccar
parent2c5d65c30159b620eebce8dd7b8a768c06271031 (diff)
parent83af89dfe56753ab932014b89646c17577ba913d (diff)
downloadtrackermap-server-80dd9eebab6cb90761d325852536395879d9412f.tar.gz
trackermap-server-80dd9eebab6cb90761d325852536395879d9412f.tar.bz2
trackermap-server-80dd9eebab6cb90761d325852536395879d9412f.zip
Merge pull request #4828 from freyfogle/master
Pass language to OpenCage geocoder
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/MainModule.java2
-rw-r--r--src/main/java/org/traccar/geocoder/OpenCageGeocoder.java9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index d72e04588..842f7e3ce 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -181,7 +181,7 @@ public class MainModule extends AbstractModule {
case "mapquest":
return new MapQuestGeocoder(url, key, cacheSize, addressFormat);
case "opencage":
- return new OpenCageGeocoder(url, key, cacheSize, addressFormat);
+ return new OpenCageGeocoder(url, key, language, cacheSize, addressFormat);
case "bingmaps":
return new BingMapsGeocoder(url, key, cacheSize, addressFormat);
case "factual":
diff --git a/src/main/java/org/traccar/geocoder/OpenCageGeocoder.java b/src/main/java/org/traccar/geocoder/OpenCageGeocoder.java
index 56161e52c..bbcc00cd0 100644
--- a/src/main/java/org/traccar/geocoder/OpenCageGeocoder.java
+++ b/src/main/java/org/traccar/geocoder/OpenCageGeocoder.java
@@ -21,16 +21,19 @@ import javax.json.JsonObject;
public class OpenCageGeocoder extends JsonGeocoder {
- private static String formatUrl(String url, String key) {
+ private static String formatUrl(String url, String key, String language) {
if (url == null) {
url = "https://api.opencagedata.com/geocode/v1";
}
url += "/json?q=%f,%f&no_annotations=1&key=" + key;
+ if (language != null) {
+ url += "&language=" + language;
+ }
return url;
}
- public OpenCageGeocoder(String url, String key, int cacheSize, AddressFormat addressFormat) {
- super(formatUrl(url, key), cacheSize, addressFormat);
+ public OpenCageGeocoder(String url, String key, String language, int cacheSize, AddressFormat addressFormat) {
+ super(formatUrl(url, key, language), cacheSize, addressFormat);
}
@Override