Skip to content

Change latitude and longitude parsing to return degs/mins rather than decimal degrees #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

reportingsjr
Copy link

This fixes #10. The parsed latitude and longitude return a list of degrees and minutes rather than decimal degrees to preserve the precision of the location returned by the GPS IC.

The only example that uses the latitude and longitude was updated to match this as well (gps_simpletest.py). I tested this code change with an M0 adalogger feather and the ultimate gps wing.

…inutes versus decimal degrees to increase data precision.
@reportingsjr
Copy link
Author

Oh, I should add:
I used a list instead of a tuple, because right after this data is parsed the degrees portion is modified to be positive or negative based on if the location is N/S or E/W.
Also, this is a breaking change for the API.

@reportingsjr
Copy link
Author

And lastly, here is a way to get a string with reasonable precision decimal degrees:

latitude = '{}.{:06d}'.format(int(gps.latitude[0]),int((gps.latitude[1]*100000)/6))
longitude = '{}.{:06d}'.format(int(gps.longitude[0]),int((gps.longitude[1]*100000)/6))

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

I'd prefer a named tuple instead of a list. As it is now, its hard to know what the two things are. A named tuple will enable latitude.degrees and latitude.minutes. Perhaps parse will return a normal tuple and then at the call it can be latitude_degrees, latitude_minutes = _parse_degrees(data[1]). Make sense? Thanks for the change!

@kattni
Copy link
Contributor

kattni commented Nov 29, 2018

@reportingsjr Please consider the changes requested on this PR.

I will be leaving this PR open for one more week. If there is no activity on it by then, I will be closing it. At that point, it can be reopened when you're ready to revisit it.

@kattni
Copy link
Contributor

kattni commented May 7, 2019

This has been determined to be an issue with the way floats and strings are handled in CircuitPython. Closing. Comments in #10

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.

Clarify that longitude/latitude precision is reduced with this library
3 participants