aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/geocode/Address.java10
-rw-r--r--src/org/traccar/geocode/AddressFormat.java2
-rw-r--r--src/org/traccar/geocode/NominatimReverseGeocoder.java13
3 files changed, 23 insertions, 2 deletions
diff --git a/src/org/traccar/geocode/Address.java b/src/org/traccar/geocode/Address.java
index 68c41b356..144a49474 100644
--- a/src/org/traccar/geocode/Address.java
+++ b/src/org/traccar/geocode/Address.java
@@ -67,6 +67,16 @@ public class Address {
this.settlement = settlement;
}
+ private String suburb;
+
+ public String getSuburb() {
+ return suburb;
+ }
+
+ public void setSuburb(String suburb) {
+ this.suburb = suburb;
+ }
+
private String street;
public String getStreet() {
diff --git a/src/org/traccar/geocode/AddressFormat.java b/src/org/traccar/geocode/AddressFormat.java
index a90de8c5e..a2a0862bf 100644
--- a/src/org/traccar/geocode/AddressFormat.java
+++ b/src/org/traccar/geocode/AddressFormat.java
@@ -27,6 +27,7 @@ import java.text.ParsePosition;
* %s - state
* %d - district
* %t - settlement (town)
+ * %u - suburb
* %r - street (road)
* %h - house
*
@@ -62,6 +63,7 @@ public class AddressFormat extends Format {
result = replace(result, "%s", address.getState());
result = replace(result, "%d", address.getDistrict());
result = replace(result, "%t", address.getSettlement());
+ result = replace(result, "%u", address.getSuburb());
result = replace(result, "%r", address.getStreet());
result = replace(result, "%h", address.getHouse());
diff --git a/src/org/traccar/geocode/NominatimReverseGeocoder.java b/src/org/traccar/geocode/NominatimReverseGeocoder.java
index 933d9389c..c1481d1cb 100644
--- a/src/org/traccar/geocode/NominatimReverseGeocoder.java
+++ b/src/org/traccar/geocode/NominatimReverseGeocoder.java
@@ -40,15 +40,24 @@ public class NominatimReverseGeocoder extends JsonReverseGeocoder {
if (result.containsKey("road")) {
address.setStreet(result.getString("road"));
}
+ if (result.containsKey("suburb")) {
+ address.setSuburb(result.getString("suburb"));
+ }
+
if (result.containsKey("village")) {
address.setSettlement(result.getString("village"));
- }
- if (result.containsKey("city")) {
+ } else if (result.containsKey("town")) {
+ address.setSettlement(result.getString("town"));
+ } else if (result.containsKey("city")) {
address.setSettlement(result.getString("city"));
}
+
if (result.containsKey("state_district")) {
address.setDistrict(result.getString("state_district"));
+ } else if (result.containsKey("region")) {
+ address.setDistrict(result.getString("region"));
}
+
if (result.containsKey("state")) {
address.setState(result.getString("state"));
}