aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/GeocoderHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-20 22:37:50 +1200
committerGitHub <noreply@github.com>2017-06-20 22:37:50 +1200
commit98ba0e282a64ecddb7bb8f1b2075b5bab0ef3eac (patch)
tree825c03638ad5f3fb73016035c35c97523edc8784 /src/org/traccar/GeocoderHandler.java
parent6f569b6d62b110c2679772c4a56122db6a614ed9 (diff)
parent9129b6f4eb6ab58a83107e47c888bb4a3bbf0f90 (diff)
downloadtrackermap-server-98ba0e282a64ecddb7bb8f1b2075b5bab0ef3eac.tar.gz
trackermap-server-98ba0e282a64ecddb7bb8f1b2075b5bab0ef3eac.tar.bz2
trackermap-server-98ba0e282a64ecddb7bb8f1b2075b5bab0ef3eac.zip
Merge pull request #3269 from Abyss777/distance_optimization
Distance calculation optimization
Diffstat (limited to 'src/org/traccar/GeocoderHandler.java')
-rw-r--r--src/org/traccar/GeocoderHandler.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/org/traccar/GeocoderHandler.java b/src/org/traccar/GeocoderHandler.java
index c5f4d2f9a..2742ff1a7 100644
--- a/src/org/traccar/GeocoderHandler.java
+++ b/src/org/traccar/GeocoderHandler.java
@@ -22,7 +22,6 @@ import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
import org.traccar.geocoder.AddressFormat;
import org.traccar.geocoder.Geocoder;
-import org.traccar.helper.DistanceCalculator;
import org.traccar.helper.Log;
import org.traccar.model.Position;
@@ -62,10 +61,7 @@ public class GeocoderHandler implements ChannelUpstreamHandler {
if (geocoderReuseDistance != 0) {
Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
if (lastPosition != null && lastPosition.getAddress() != null) {
- double distance = DistanceCalculator.distance(
- position.getLatitude(), position.getLongitude(),
- lastPosition.getLatitude(), lastPosition.getLongitude());
- if (distance <= geocoderReuseDistance) {
+ if (position.getDouble(Position.KEY_DISTANCE) <= geocoderReuseDistance) {
position.setAddress(lastPosition.getAddress());
Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
return;