Calculate Trip Distance WRONG

Sumit6 years ago

In position table, the trip defining algorithm is taking the positions correctly but my problem is the trip is calculating the distance wrong when it reports it after long time (in my case after 14 days). The deviceTime increase as usual but fixTime reports as last 14 days before time and when the device moves, fixTime is changed (as deviceTime). I am calculating the distance using {latitude. longitude and altitude}. In defined algorithm, it is done by odometer or totalDistance. Please let me know I am calculating the distance in a right way. And what for the suggestion to deal with this thing. And this problem is being in only one trip.
Thank you.

Anton Tananaev6 years ago

What exactly is wrong? I can't really follow your description of the problem.

Sumit6 years ago

In the "detectTripAndStop" algo. the distance is calculated by odometer and totalDistance. But I am calculating the distance via {latitude, logitude and altitude}. I want to know this is right way to calculate the distance what I am doing.

My one of the devices had sent the positions after 14 days and when it reports on the day it gets fixTime last 14 days time and after some time it gets deviceTime. I am not understood by this thing. Any suggestion for this!!!

And some time, trips are cut in starting a little bit. What can be reason for this also?

Anton Tananaev6 years ago

Obviously you can calculate distance using coordinates. I don't don't really understand this question.

I still don't get your question about 14 days. I would recommend to find someone who can clearly explain the problem in English.

As for trip calculation, you can read official documentation to understand how it works.

Sumit6 years ago

alt text

At Position id=1176416 (device last reporting time).

At Position id=1320515 (device was activated to send the data but it was getting last location defined by Position id=1176416 while device was somewhere another location or near to the location of Position Id=1320583).

At Position id=1320583 (device next reporting time) when device was moving.

and trip starts from position id=1320583 and it is calculating the distance from 1320580 not calculating the 1320583.

Therefore, the trip has some extra Distance.

Anton Tananaev6 years ago

It looks like your device reported locations in wrong order. In such case Traccar distance calculation will be incorrect, so you can't rely on it.