Skip to content

Add location accuracy#4414

Draft
iandolge wants to merge 2 commits into
beeware:mainfrom
iandolge:feat/location-accuracy
Draft

Add location accuracy#4414
iandolge wants to merge 2 commits into
beeware:mainfrom
iandolge:feat/location-accuracy

Conversation

@iandolge
Copy link
Copy Markdown
Contributor

@iandolge iandolge commented May 19, 2026

Add altitude and accuracy figures to the LatLon class

This changes the LatLon class to include extra attributes but maintains that this class is comparable to a tuple of (lat, lng). See core/tests/test_types.py for the contract. Each platform that supports location has been modified to populate these values.

Makes accuracy information available for macOS, iOS, Android, and Linux(GTK)

Fixes #3112

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by:

@iandolge
Copy link
Copy Markdown
Contributor Author

@freakboy3742 I think I'm settled on the implementation but I still need to go through and update tests beyond the core tests and check things out. I know the naming remains awkward and the altitude now exists in two spots, any feedback would be welcome.

Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main issue here is that the data types we've got here aren't what we need (and that's historical - not something you've introduced). We've separated LatLng from altitude - and that complicates everything we're doing, and ends up with us trying to cram altitude into a LatLng sized hole.

I'm wondering if the solution here is to:

  1. Rename the LatLng structure to something like GeoPosition that includes accuracy and altitude components
  2. Modify the on_change handler to return position, location and altitude
  3. Formally deprecate the location and altitude arguments to on_change (and raise warnings when an on_change handler is set by inspecting the handler that is provided

Does that makes sense?

@iandolge
Copy link
Copy Markdown
Contributor Author

I think that makes sense! I'll make another round of updates this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

current_location() could also return LatLng's accuracy

2 participants