From eee59141bd21d929467819a8eb6c904140efceaa Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 13 Jul 2017 02:47:03 +1200 Subject: Fix max speed filtering (fix #3342) --- src/org/traccar/BasePipelineFactory.java | 3 ++- src/org/traccar/FilterHandler.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index a6446dbaa..bde4b558b 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -125,7 +125,8 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { } } - distanceHandler = new DistanceHandler(Context.getConfig().getBoolean("coordinates.filter"), + distanceHandler = new DistanceHandler( + Context.getConfig().getBoolean("coordinates.filter"), Context.getConfig().getInteger("coordinates.minError"), Context.getConfig().getInteger("coordinates.maxError")); diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index 9e532347d..71c0a1cf5 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -127,7 +127,7 @@ public class FilterHandler extends BaseDataHandler { if (filterMaxSpeed != 0 && last != null) { double distance = position.getDouble(Position.KEY_DISTANCE); long time = position.getFixTime().getTime() - last.getFixTime().getTime(); - return UnitsConverter.knotsFromMps(distance / time) > filterMaxSpeed; + return UnitsConverter.knotsFromMps(distance / (time / 1000)) > filterMaxSpeed; } return false; } -- cgit v1.2.3