aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-13 23:58:47 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-13 23:58:47 +1300
commit655d7cba4a63db2058d08f04fe5a7cdcb4067017 (patch)
treecfcf323a07b2883aeacd0a827499e20464d5f5dc /src/org/traccar
parent2be68b0e9c1f26f329d5cf1d836cffdf8d506b8e (diff)
downloadtrackermap-server-655d7cba4a63db2058d08f04fe5a7cdcb4067017.tar.gz
trackermap-server-655d7cba4a63db2058d08f04fe5a7cdcb4067017.tar.bz2
trackermap-server-655d7cba4a63db2058d08f04fe5a7cdcb4067017.zip
Improve OpenCage reverse decoder
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/geocode/BingMapsReverseGeocoder.java4
-rw-r--r--src/org/traccar/geocode/FactualReverseGeocoder.java4
-rw-r--r--src/org/traccar/geocode/MapQuestReverseGeocoder.java4
-rw-r--r--src/org/traccar/geocode/OpenCageReverseGeocoder.java14
4 files changed, 10 insertions, 16 deletions
diff --git a/src/org/traccar/geocode/BingMapsReverseGeocoder.java b/src/org/traccar/geocode/BingMapsReverseGeocoder.java
index a5ebbd420..69148875a 100644
--- a/src/org/traccar/geocode/BingMapsReverseGeocoder.java
+++ b/src/org/traccar/geocode/BingMapsReverseGeocoder.java
@@ -20,10 +20,6 @@ import javax.json.JsonObject;
public class BingMapsReverseGeocoder extends JsonReverseGeocoder {
- public BingMapsReverseGeocoder() {
- this("http://dev.virtualearth.net/REST/v1", "ABCDE", 0);
- }
-
public BingMapsReverseGeocoder(String url, String key, int cacheSize) {
super(url + "/Locations/%f,%f?key=" + key + "&include=ciso2", cacheSize);
}
diff --git a/src/org/traccar/geocode/FactualReverseGeocoder.java b/src/org/traccar/geocode/FactualReverseGeocoder.java
index 6e5a48423..15211f74a 100644
--- a/src/org/traccar/geocode/FactualReverseGeocoder.java
+++ b/src/org/traccar/geocode/FactualReverseGeocoder.java
@@ -19,10 +19,6 @@ import javax.json.JsonObject;
public class FactualReverseGeocoder extends JsonReverseGeocoder {
- public FactualReverseGeocoder() {
- this("https://api.factual.com/geotag", "ABCDE", 0);
- }
-
public FactualReverseGeocoder(String url, String key, int cacheSize) {
super(url + "?latitude=%f&longitude=%f&KEY=" + key, cacheSize);
}
diff --git a/src/org/traccar/geocode/MapQuestReverseGeocoder.java b/src/org/traccar/geocode/MapQuestReverseGeocoder.java
index be3f51b04..93edfdd09 100644
--- a/src/org/traccar/geocode/MapQuestReverseGeocoder.java
+++ b/src/org/traccar/geocode/MapQuestReverseGeocoder.java
@@ -20,10 +20,6 @@ import javax.json.JsonObject;
public class MapQuestReverseGeocoder extends JsonReverseGeocoder {
- public MapQuestReverseGeocoder() {
- this("http://www.mapquestapi.com/geocoding/v1/reverse", "ABCDE", 0);
- }
-
public MapQuestReverseGeocoder(String url, String key, int cacheSize) {
super(url + "?key=" + key + "&location=%f,%f", cacheSize);
}
diff --git a/src/org/traccar/geocode/OpenCageReverseGeocoder.java b/src/org/traccar/geocode/OpenCageReverseGeocoder.java
index 3104cb56a..b5b31179e 100644
--- a/src/org/traccar/geocode/OpenCageReverseGeocoder.java
+++ b/src/org/traccar/geocode/OpenCageReverseGeocoder.java
@@ -1,5 +1,6 @@
/*
* Copyright 2014 - 2015 Stefaan Van Dooren (stefaan.vandooren@gmail.com)
+ * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +21,6 @@ import javax.json.JsonObject;
public class OpenCageReverseGeocoder extends JsonReverseGeocoder {
- public OpenCageReverseGeocoder() {
- this("https://api.opencagedata.com/geocode/v1", "ABCDE", 0);
- }
-
public OpenCageReverseGeocoder(String url, String key, int cacheSize) {
super(url + "/json?q=%f,%f&key=" + key, cacheSize);
}
@@ -36,12 +33,21 @@ public class OpenCageReverseGeocoder extends JsonReverseGeocoder {
if (location != null) {
Address address = new Address();
+ if (location.containsKey("building")) {
+ address.setHouse(location.getString("building"));
+ }
if (location.containsKey("house_number")) {
address.setHouse(location.getString("house_number"));
}
if (location.containsKey("road")) {
address.setStreet(location.getString("road"));
}
+ if (location.containsKey("suburb")) {
+ address.setSuburb(location.getString("suburb"));
+ }
+ if (location.containsKey("city")) {
+ address.setSettlement(location.getString("city"));
+ }
if (location.containsKey("city_district")) {
address.setSettlement(location.getString("city_district"));
}