`current_location()` could also return `LatLng`'s accuracy
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 40
Description
### What is the problem or limitation you are having?
I'd like to know how accurate the GPS coordinates received from the OS are. They can often be really far from reality, and it would be helpful to know if this is the case.
### Describe the solution you'd like
[`toga.hardware.location.Location.current_location()`](https://github.com/beeware/toga/blob/fbedd3ff019a67e33a459c95bea2cee6eb3a3faf/core/src/toga/hardware/location.py#L172-L198) could also return the horizontal and vertical accuracy of the recorded `LatLng`.
### Describe alternatives you've considered
Writing a method myself that estimates the location accuracy by checking if the coordinates are stable (near each other) or "jumping around". But this would be an approximation of the approximation.
### Additional context
Maybe it can be done like this?
**Apple**
The [macOS](https://github.com/beeware/toga/blob/fbedd3ff019a67e33a459c95bea2cee6eb3a3faf/cocoa/src/toga_cocoa/hardware/location.py#L12-L28) and [iOS](https://github.com/beeware/toga/blob/fbedd3ff019a67e33a459c95bea2cee6eb3a3faf/iOS/src/toga_iOS/hardware/location.py#L15-L31) versions of `toga_location()` should also return [`horizontalAccuracy`](https://developer.apple.com/documentation/corelocation/cllocation/horizontalaccuracy) and [`verticalAccuracy`](https://developer.apple.com/documentation/corelocation/cllocation/verticalaccuracy).
**Android**
[`toga_location()`](https://github.com/beeware/toga/blob/fbedd3ff019a67e33a459c95bea2cee6eb3a3faf/android/src/toga_android/hardware/location.py#L15-L30) should also return the return values of [`getAccuracy()`](https://developer.android.com/reference/android/location/Location#getAccuracy()) (only if [`hasAccuracy()`](https://developer.android.com/reference/android/location/Location#hasAccuracy()) is `true`) and [`getVerticalAccuracyMeters()`](https://developer.android.com/reference/android/location/Location#getVerticalAccuracyMeters()) (only if [`hasVerticalAccuracy()`](https://developer.android.com/reference/android/location/Location#hasVerticalAccuracy()) is `true`).
**Linux (GTK)**
[`toga_location()`](https://github.com/beeware/toga/blob/9a241c5135a117bbcb9f1cae70507e748df526ee/gtk/src/toga_gtk/hardware/location.py#L35-L43) should also return the return value of the [`accuracy`](https://www.freedesktop.org/software/geoclue/docs/libgeoclue/GClueLocation.html#GClueLocation--accuracy) property, which probably refers to the horizontal accuracy. Vertical accuracy is unavailable on this platform.
Contributor guide
Research direction
Start with core/src/toga/hardware/location.py and compare the platform implementations in cocoa/src/toga_cocoa/hardware/location.py, iOS/src/toga_iOS/hardware/location.py, android/src/toga_android/hardware/location.py, and gtk/src/toga_gtk/hardware/location.py. Determine how horizontal and vertical accuracy should be represented in LatLng, then verify that each platform exposes the available values and handles unavailable accuracy consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, ios, linux, macos, python
- Domain
- desktop-dev, mobile-dev, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100