aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-25 00:14:05 +1300
committerGitHub <noreply@github.com>2016-10-25 00:14:05 +1300
commit98b6e3f4d727e8504d035bcc779be8eb3aa8feae (patch)
treee0623d2082cc5526768927a653d9b464e7bf0c1f /src/org/traccar
parent6e1b6dc596e50fe0460abbc252540674c72153b1 (diff)
parent38c285dc91f0960e3a4bd5804d42c7dd293fc7d3 (diff)
downloadtrackermap-server-98b6e3f4d727e8504d035bcc779be8eb3aa8feae.tar.gz
trackermap-server-98b6e3f4d727e8504d035bcc779be8eb3aa8feae.tar.bz2
trackermap-server-98b6e3f4d727e8504d035bcc779be8eb3aa8feae.zip
Merge pull request #2480 from Abyss777/coordinates
Add maximum coordinates error to CoordinatesHandler
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/CoordinatesHandler.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/CoordinatesHandler.java b/src/org/traccar/CoordinatesHandler.java
index 2dcb3c632..7d1c43284 100644
--- a/src/org/traccar/CoordinatesHandler.java
+++ b/src/org/traccar/CoordinatesHandler.java
@@ -20,11 +20,13 @@ import org.traccar.model.Position;
public class CoordinatesHandler extends BaseDataHandler {
- private final int coordinatesError;
+ private final int coordinatesMinError;
+ private final int coordinatesMaxError;
public CoordinatesHandler() {
Config config = Context.getConfig();
- coordinatesError = config.getInteger("coordinates.error", 50);
+ coordinatesMinError = config.getInteger("coordinates.minError", 50);
+ coordinatesMaxError = config.getInteger("coordinates.maxError", 1000000);
}
private Position getLastPosition(long deviceId) {
@@ -40,7 +42,7 @@ public class CoordinatesHandler extends BaseDataHandler {
if (last != null) {
double distance = DistanceCalculator.distance(
position.getLatitude(), position.getLongitude(), last.getLatitude(), last.getLongitude());
- if (distance < coordinatesError) {
+ if (distance < coordinatesMinError || distance > coordinatesMaxError) {
position.setLatitude(last.getLatitude());
position.setLongitude(last.getLongitude());
}