Traccar coordinates filtering issue

Victor Butlera year ago

Hi,

So I have a strange problem with coordinates filtering in Traccar using the following setting:

<entry key='coordinates.filter'>true</entry>
<entry key='coordinates.minError'>20</entry>
<entry key='coordinates.maxError'>500000</entry>

According to the configuration instructions, those settings will filter coordinates if the distance is larger than 500km AND the second record is Invalid.

My second record is valid and the coordinates still get filtered.

Here is the log exmaple:

2023-10-25 19:15:26 INFO: [U7e787b12: teltonika < 146.88.208.32] 0073CAFE0106000F3030303030303030303030303030308E010000018B6841706800C146FFF20C4C2275000000000000000000000E000700EF0000F00000500400150300C8030045030071640005004233320043101A00110061001200020013FFCA0002001000507D7801C1000A30F90000000001
2023-10-25 19:15:26 INFO: [U7e787b12: teltonika > 146.88.208.32] 00050000010601
2023-10-25 19:15:26 INFO: [U7e787b12] id: 000000000000000, time: 2023-10-25 19:13:21, lat: 18.66430, lon: -68.42658, course: 0.0

From Traccar interface:
outdated No
valid Yes

Any idea why the coordinates get filtered?

Victor Butlera year ago

UPDATE:
I tried to manually update in the positions table the latitude and longitude for the last record for that particular device. Once the coordinates are updated, the vehicle is shown on the correct location on the map.

However, when the next record from the device comes in, the coordinates get switched back to the old wrong values, despite the HEX having the correct data.

How is that possible?

Track-tracea year ago

You use other filters also?

Victor Butlera year ago

The only other filters I have are but I don't think it's related:

<entry key='filter.enable'>true</entry>
<entry key='event.overspeed.notRepeat'>true</entry>
<entry key='filter.zero'>true</entry>

First one shouldn't case this.
The second and third one might but not in this case - there is no overspeed alert and the coordinates are not zeros (the record gets saved, just with the wrong coordinates).

Anton Tananaeva year ago

You can't manually update position in the database and expect it to work. There's internal cache, so when you update database directly, the behavior is completely unpredictable.

Victor Butlera year ago

Thanks Anton! I suspected it might be the cache overwriting the manual changes. That's fine.

Still, this doesn't explain why the valid coordinates are being filtered by coordinates.maxError setting. Any suggestion where to look for the problem?

PS. I will fix this particular issue by disabling the filter but I would also like to make sure this doesn't happen again. If it's a bug in Traccar we have a chance to find and fix it.

Anton Tananaeva year ago

You have you to compare the distance. Max error is a very dangerous parameter because you can get stuck in an invalid location. For example if you start with 0,0 coordinates and then move to whatever you real location is, it will filter that jump and you will stay at 0,0 forever.

Victor Butlera year ago

Thank you for the feedback but I got a bit confused.

In your example if we start with 0,0 coordinates and then move to the real location with valid coordinates why would that jump be skipped? Isn't the coordinates.maxError filtering only the invalid GPS coordinates if they exceed the threshold?

In my case, the coordinates.maxError is 500000m, i.e. 500 km. The distance between the old and the real location is about 3,800km. So the maxError setting should filter the new coordinates (this is correct), only if the new coordinates are invalid (this is incorrect because the coordinates are valid according to Traccar).

What am I missing?

Anton Tananaeva year ago

Actually you're right. We have a check for invalid location.

Victor Butlera year ago

And yet the valid coordinates get overwritten. Any suggestions at where I should look for the problem?

Anton Tananaeva year ago

I just checked the code and the invalid flag check is not there. I guess it was removed at some point. Maybe by mistake.

Victor Butlera year ago

Well, issue resolved then. I will wait for the next version to get this fixed.

Thank you for the help, Anton!

Anton Tananaeva year ago

Don't forget to file a bug report, so it actually gets fixed.

Victor Butlera year ago

It's done.

El parámetro coordinates.minError establece el error mínimo permitido para las coordenadas. En este caso, el valor es 20. Este parámetro es relevante para garantizar que las coordenadas reportadas sean lo suficientemente precisas y no incluyan lecturas inestables o incorrectas.

Si este valor es demasiado restrictivo, podría filtrar ubicaciones válidas que están dentro de un rango de error normal. Por ejemplo, si el dispositivo se está moviendo lentamente o está sujeto a fluctuaciones normales en la precisión del GPS, el error puede ser mayor que 20 metros en ciertos momentos. Si se establece coordinates.minError en un valor muy bajo, las coordenadas que superen este límite podrían ser consideradas incorrectas y filtrarse.

Por otro lado, establecer coordinates.minError en un valor razonable y adecuado permite la flexibilidad necesaria para acomodar pequeñas variaciones en la precisión del GPS sin rechazar ubicaciones válidas.