aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ReverseGeocoderHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-07 15:39:42 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-07 15:39:42 +1200
commit953852e6e984f8a639cf1a5ac4116fff755d538a (patch)
tree1902beb226bfa2ba7b60b20a310b376e8e86ce76 /src/org/traccar/ReverseGeocoderHandler.java
parent6a07fc479021dbf61143d432285c573faf38d6b9 (diff)
downloadtrackermap-server-953852e6e984f8a639cf1a5ac4116fff755d538a.tar.gz
trackermap-server-953852e6e984f8a639cf1a5ac4116fff755d538a.tar.bz2
trackermap-server-953852e6e984f8a639cf1a5ac4116fff755d538a.zip
Add Gisgraphy reverse geocoder
Diffstat (limited to 'src/org/traccar/ReverseGeocoderHandler.java')
-rw-r--r--src/org/traccar/ReverseGeocoderHandler.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/ReverseGeocoderHandler.java b/src/org/traccar/ReverseGeocoderHandler.java
index e48a11424..73254673c 100644
--- a/src/org/traccar/ReverseGeocoderHandler.java
+++ b/src/org/traccar/ReverseGeocoderHandler.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
+import org.traccar.geocode.AddressFormat;
import org.traccar.geocode.ReverseGeocoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -27,10 +28,12 @@ public class ReverseGeocoderHandler extends OneToOneDecoder {
private final ReverseGeocoder geocoder;
private final boolean processInvalidPositions;
+ private final AddressFormat addressFormat;
public ReverseGeocoderHandler(ReverseGeocoder geocoder, boolean processInvalidPositions ) {
this.geocoder = geocoder;
this.processInvalidPositions = processInvalidPositions;
+ addressFormat = new AddressFormat();
}
@Override
@@ -44,14 +47,14 @@ public class ReverseGeocoderHandler extends OneToOneDecoder {
if (processInvalidPositions || position.getValid()) {
position.setAddress(geocoder.getAddress(
- position.getLatitude(), position.getLongitude()));
+ addressFormat, position.getLatitude(), position.getLongitude()));
}
} else if (msg instanceof List) {
List<Position> positions = (List<Position>) msg;
for (Position position : positions) {
if (processInvalidPositions || position.getValid()) {
position.setAddress(geocoder.getAddress(
- position.getLatitude(), position.getLongitude()));
+ addressFormat, position.getLatitude(), position.getLongitude()));
}
}
}