n76 / DejaVu

Yet another network location backend for the UnifiedNLP/microG project
GNU General Public License v3.0
100 stars 18 forks source link

Wrong locations reported #33

Open Helium314 opened 4 years ago

Helium314 commented 4 years ago

I have the issue that DejaVu sometimes reports clearly wrong locations. There seem to be at least 2 different cases how this happens:

a) DejaVu reports a location far away, tens (in one case even hundreds) of km away from actual position. Every time it is the location of a GSM tower with the ID ending in /0/0 (in DejaVu database). Are these entries even valid? http://www.cell2gps.com/ can't find any of those towers, same thing for the ones just ending in /0.

b) DejaVu reports a location a few km away, sometimes (rarely) even repeatedly over the course of several minutes and km while moving. When looking in the database, I always find (one or more) WiFi entries near that location, and often the SSID indicates a stationary WiFi (e.g. a restaurant). Contrary to case a), there is nothing unusual in the entries. Trust is always at or close to 100. It is impossible that my phone really sees the WiFi due to distance and houses in between, but apparently it still reports those WiFis. I am not sure whether this a problem of my phone or some bug in DejaVu...

Device: S4 Mini Duos AOKP (LineageOS 14.1 based) MicroG 0.2.8.17785-mapbox DejaVu 1.1.12 (no other location backends)

n76 commented 4 years ago

Thank you for the issue report. I will investigate it when I get back from international travel in a few weeks.

There are a few anomalies I have noticed, though yours sounds slightly different than I've seen. Once I get back to my development system I will look into this.

Helium314 commented 4 years ago

Over the past 2 weeks I logged really every single location and had a closer look at the problems.

to a) It looks like my phone (almost) only finds GSM towers with ID ending on /0/0 soon after a reboot. Would it be a good solution to just blacklist them? For the GSM towers ending in /0 but not /0/0 sometimes there are 'bad' locations, but not nearly as far from my real position as the /0/0 towers. Since from some areas I only see /0 GSM towers in the database, I guess there is not much that can be done.

c) (new) It looks like Deja Vu has some trouble with mobile hotspots that don't have blacklisted SSIDs. In one case Deja Vu kept reporting the initially detected WiFi location even though GPS reported tens of locations several km away over more than a minute. If I read the code somewhat correctly, the locations might have been ignored due to bad accuracy (most were worse than the 40m limit for 2.4 GHz). This is in line with the mobile hotspot still having trust 87 in the database. Is it possible (and a good idea) to reduce the accuracy requirement for decreasing trust if the distance is large?

Actually that leads me to another problem relatied to mobile hotspots that get removed because of low trust. It looked like the hotspot was found and gave me a few bad locations, but was removed after several (good accuracy) GPS locations. A bit later the hotspot was found again at a different location and the bad locations started again (at a different place) until I got high accuracy GPS locations. It was not possible for me to really get rid of them... If I read the code correctly (which I am not good at), the hotspot was removed from the database due to low trust, but then it was discovered again at a new location. Then it got removed and re-discovered again... A solution could be to not remove the hotspot from the database (and keep decreasing trust), or to have some kind of additional blacklist.

d) (new) The reported accuracy often is somewhat too high. It can happen that I am inside the ns/ew radius I read from the database, but outside the circle that actually gets reported. It is not a big issue, but still seems strange when I am outside accuracy circle (by up to 80% of the accuracy), and no amount of GPS locations changes this. Why is the reported accuracy smaller than the sqrt(radius_ns² + radius_ew²) I find in the code?

Helium314 commented 4 years ago

Another update, this time regarding b) 2 of the 4 5GHz WiFis I have in in my database seem to cause this issue especially frequently. In on case I found several GPS locations with 6 m precision and a 2 second difference between them, while Deja Vu reports a 5 GHz Wifi location several km away. When other WiFis were found (just a few seconds before that), Deja Vu reported the correct positions. I don't understand why both of these WiFis still have trust 100 after this... GPS should be accurate enough to remove them.

Helium314 commented 4 years ago

Yet another update: looks like I understood the way Deja Vu works quite wrong (and probably still dont properly understand it). So... trust is only used to confirm the emitter exists, and is decreased when it is not found at the expected position, right? And what actually happend with the hotspots was that they are moved as their radius was too large. So I tried the app in a modified version where move check is disabled and emitters with radius > moveDetectDistance are treated like blacklisted. This helps a lot, though it is not a good solution as it also permanently removes emitters that are only moved once.