It's calculated from the last known position by time, to the current position. What made you think that those two are used for calculation?
But while call API for routes how that distance is calculated ?
As per above records last one is the next record to first one and the distance between both is 23 meter and it is giving the distance 2856.93
May be due to a time difference of 3 minutes between deviceTime and serverTime ?
Distance is calculated at the time when position is inserted in the database. It's NOT re-calculated at any later point.
I agreed but when that device is at one position and then it moves to second position then why it is giving distance 2856.93 meters when actually the actual distance is 23 meters only ?
I am talking about calculated distance when it has been inserted in database (database records).
Hello Anton,
Is there any update on this issue ?
No updates. Please read my first comment on this thread.
Hello Anton,
I just want to know how distance attribute calculated ?
Is it a distance between two positions (last one and current one)
if yes then please check the below API response
{ "id": 10231709, "attributes": { "charge": true, "ignition": true, "in2": 0, "panic": 0, "out2": 0, "fuel": 0, "odometer": 7471307, "distance": 92.65, "totalDistance": 23288662.53, "motion": true, "hours": 6132111000, "power": 0 }, "deviceId": 4, "type": null, "protocol": "tk103", "serverTime": "2018-10-26T05:54:07.000+0000", "deviceTime": "2018-10-26T05:54:04.000+0000", "fixTime": "2018-10-26T05:54:04.000+0000", "outdated": false, "valid": true, "latitude": 23.081405, "longitude": 72.52656666666667, "altitude": 0, "speed": 22.5702, "course": 15.1, "address": null, "accuracy": 0, "network": null }, { "id": 10231994, "attributes": { "charge": true, "ignition": true, "in2": 0, "panic": 0, "out2": 0, "fuel": 0, "odometer": 7471329, "distance": 2856.93, "totalDistance": 23294399.03, "motion": true, "hours": 6132113000, "power": 0 }, "deviceId": 4, "type": null, "protocol": "tk103", "serverTime": "2018-10-26T05:57:46.000+0000", "deviceTime": "2018-10-26T05:54:06.000+0000", "fixTime": "2018-10-26T05:54:06.000+0000", "outdated": false, "valid": true, "latitude": 23.081601666666668, "longitude": 72.52662, "altitude": 0, "speed": 21.2743, "course": 14.5, "address": null, "accuracy": 0, "network": null },
According to those two positions the distance between them is 23meter only but it is giving me distance more then 2.5 km
Can you please guide, How "distance": 2856.93 calculated ?