aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ReverseGeocoderHandler.java
diff options
context:
space:
mode:
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()));
}
}
}