Baseflow / flutter-geolocator

Android and iOS Geolocation plugin for Flutter
https://baseflow.com/
MIT License
1.24k stars 653 forks source link

accuracy problem #1022

Closed BFSistemi closed 2 years ago

BFSistemi commented 2 years ago

hi I am new with flutter and apologize for my english.

os:Android

if I call this function 10 times

return await Geolocator.getCurrentPosition(
      desiredAccuracy: LocationAccuracy.high,
      forceAndroidLocationManager: true,
      timeLimit: Duration(seconds: 15),
    );

lat xx.xxxx058 lon xx.xxxx388 lat xx.xxxx053 lon xx.xxxx398 lat xx.xxxx064 lon xx.xxxx385 lat xx.xxxx062 lon xx.xxxx367 lat xx.xxxx057 lon xx.xxxx366 lat xx.xxxx055 lon xx.xxxx368 lat xx.xxxx058 lon xx.xxxx374 ....

I get 10 different results. even though the smartphone is immobile. the difference is even 100 meters. it's normal?

Raghnall commented 2 years ago

Just and observation, but the examples you gave are not even 1 meter different from each other and can be tossed up to random variations caused by the hardware. see: http://wiki.gis.com/wiki/index.php/Decimal_degrees and https://en.wikipedia.org/wiki/Decimal_degrees

In the given data points: Max lat difference is xx.xxxx064 - xx.xxxx053 = 00.0000009 which is about 9.99cm Max long difference is xx.xxxx398 - xx.xxxx366 = 00.0000032 which is about 35.52cm

Even if the data given to you has 7 decimal digits, it doesn't mean the hardware you are using is actually accurate to 7 places. Unless you are using some exotic hardware, chances are that your hardware is really only as accurate to 5 decimal places at best (within 1 meter), and more likely 4 decimal places (within about 10 meters) without waiting too long to get it. Unless you really need sub 1 meter accuracy, chances are that you should probably just round the numbers to 5 decimal places and leave it as such. If you do really need sub 1 meter, then you probably need something better than a phone to get it.

florissmit1 commented 2 years ago

Hey @BFSistemi, thanks for reporting your issue. It can indeed occur that the the difference between the results can range from 0 to 100 meters on Android devices, depending on the device you're using etc. You can find more info regarding this topic in the geolocator documentation, see: https://pub.dev/packages/geolocator.

For now I will close this issue, since it can occur that the results differ, although the smartphone you're using is immobile. If you have more questions, feel free to open an issue any time.

The table below outlines the accuracy options per platform:

  Android iOS
lowest 500m 3000m
low 500m 1000m
medium 100 - 500m 100m
high 0 - 100m 10m
best 0 - 100m ~0m
bestForNavigation 0 - 100m Optimized for navigation