Suspicious Total Distance behavior

memesaregood17 days ago

Hello,

We are experiencing an issue where Total Distance is somehow spiking up and then decreasing back to some value. Is this a bug or an expected behavior? How do we proceed from here?

Screenshot at 2025-08-19 23-11-43.png

Anton Tananaev17 days ago

Is this the totalDistance attribute? It can only decrease when you update it manually.

memesaregood17 days ago

Yes, it is.

But this can't be right. I believe none of the users care enough to update this. The value just spikes up for some reason, and we can't figure out why. The math seems correct.

Anton Tananaev17 days ago

There might be another explanation - the data is uploaded in a wrong order. Then distance calculation can be messed up.

memesaregood16 days ago

Would filter.relative help in this case?

Anton Tananaev16 days ago

No, it won't.

memesaregood16 days ago

Any idea what would? There's nothing we can do against the devices or network issues.

Increasing server.buffering.threshold, so it reorders data?

Anton Tananaev16 days ago

Yes, you can try increasing buffering threshold. But the correct solution should be on the device side. Good devices offer an option to upload in correct chronological order.

memesaregood6 hours ago

Returning 16 days later, I have encountered this issue again. There's something wrong with the distance calculation. I've checked the data:

id       |fixtime                |devicetime             |speed             |distance          |totaldistance    |latitude          |longitude         |valid|
---------+-----------------------+-----------------------+------------------+------------------+-----------------+------------------+------------------+-----+
112293300|2025-09-03 05:18:39.000|2025-09-03 05:18:39.000|40.820015097084045|41.005100663172335|6560379.21180506 |         53.096285|103.07026333333333|true |
112293354|2025-09-03 05:18:41.000|2025-09-03 05:18:41.000| 39.06001365494537|5689.248014420947 |6571798.310220371|53.096656666666675|103.07022166666667|true |

There are no positions between these two. There is nothing abnormal in the data.
If I calculate the distance between them using the Haversine Formula you used in the DistanceCalculator, the result is 41.42 meters. How was 5 km written to the DB? Any idea?

Anton Tananaev6 hours ago

Where is the server time? How do you know there were no positions in between?

memesaregood5 hours ago

Found some other data. Seems to be network issues this time. Sorry about that.