aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocode/OpenCageReverseGeocoder.java
diff options
context:
space:
mode:
authorHans van den Elsen <hans.elsen@esds.nl>2016-03-14 20:49:04 +0100
committerHans van den Elsen <hans.elsen@esds.nl>2016-03-14 20:49:04 +0100
commit7fd1c08dd2f789ddd37ff075a6ebda1645947616 (patch)
tree75b715e6dd70f6be3357e1710c4db6f1f6a1e29e /src/org/traccar/geocode/OpenCageReverseGeocoder.java
parent4606737cc07b736f9c8f98ae680b928c94c082c8 (diff)
parent0a1019b59481b6bf8ee8989feb23cef084b6caf5 (diff)
downloadtrackermap-server-7fd1c08dd2f789ddd37ff075a6ebda1645947616.tar.gz
trackermap-server-7fd1c08dd2f789ddd37ff075a6ebda1645947616.tar.bz2
trackermap-server-7fd1c08dd2f789ddd37ff075a6ebda1645947616.zip
Merge remote-tracking branch 'refs/remotes/tananaev/master'
Diffstat (limited to 'src/org/traccar/geocode/OpenCageReverseGeocoder.java')
-rw-r--r--src/org/traccar/geocode/OpenCageReverseGeocoder.java14
1 files changed, 10 insertions, 4 deletions
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"));
}