Traccar detects trips and stops from incoming positions. This detection is used for Device Moving and Device Stopped events and for trip and stop reports. See Reports for selecting devices, choosing periods and exporting results.
The newer detection logic is enabled by default with report.trip.newLogic. It uses changes in location to detect movement and stops:
The following parameters control this logic:
| Parameter | Purpose | Default |
|---|---|---|
| report.trip.minDistance | Distance threshold for detecting movement and the area used to detect a stop. | 200 meters |
| report.trip.minDuration | Minimum time within that area to detect a stop. | 180 seconds (3 minutes) |
| report.trip.stopGap | Gap between positions after which distance and average speed are checked to split movement. | 3600 seconds (1 hour) |
| report.trip.useIgnition | Use the reported ignition state to determine moving or stopped state instead of location changes. | Disabled |
When report.trip.useIgnition is enabled and a position includes ignition, ignition on means moving and ignition off means stopped. Positions without ignition use the location-based logic.
A vehicle leaves a depot, pauses briefly at a traffic light, then parks at its destination. With the default settings and regular position updates:
Trips, stops and summary reports have two implementations. The system picks between them automatically based on the requested period: if it is longer than report.fastThreshold seconds (one day by default), the fast version is used, otherwise the slow one.
The slow version reprocesses all positions in the period and recomputes trips and stops from scratch using the current configuration. The fast version instead reuses the deviceMoving and deviceStopped events that were recorded in real time, which is much faster but less accurate. Some details are missing (for example, maximum speed is reported as zero), and the main drawback is that if positions arrive out of order, the real-time events end up misplaced and fast reports reflect those inaccuracies, while the slow version would sort positions correctly.
To use the older motion-based logic, set the following in the configuration file and restart Traccar:
<entry key='report.trip.newLogic'>false</entry>
The standardized motion attribute was introduced to have a universal way of handling device motion for all protocols. Some devices report this attribute directly. For other devices it is automatically calculated based on the speed value and the speedThreshold parameter. It is also possible to override it using computed attributes.
The system analyzes positions and switches motion state according to the configuration. Traccar switches state from stopped to moving if a device is reporting motion as true for more than minimalTripDuration seconds or if trip distance is more than minimalTripDistance meters. Traccar switches state from moving to stopped if a device is reporting motion as false for more than minimalParkingDuration seconds or if useIgnition is enabled and the ignition is off. Only continuous periods can switch the state; any fluctuations reset the detection.
The following parameters can be used to configure the detection logic: