aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-10-24 15:54:49 +0500
committerAbyss777 <abyss@fox5.ru>2016-10-24 15:54:49 +0500
commit38c285dc91f0960e3a4bd5804d42c7dd293fc7d3 (patch)
tree8894bb430341ae3bb132f63f463a80646216d763
parent91d94457e0a8eedf9824bb2c1e1bce4864308352 (diff)
downloadtraccar-server-38c285dc91f0960e3a4bd5804d42c7dd293fc7d3.tar.gz
traccar-server-38c285dc91f0960e3a4bd5804d42c7dd293fc7d3.tar.bz2
traccar-server-38c285dc91f0960e3a4bd5804d42c7dd293fc7d3.zip
Add maximum coordinates error to CoordinatesHandler
-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());
}