adafruit / Adafruit_CircuitPython_GPS

GPS parsing module for CircuitPython. Meant to parse NMEA data from serial GPS modules.
MIT License
75 stars 60 forks source link

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

Closed reportingsjr closed 5 years ago

reportingsjr commented 5 years ago

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.

reportingsjr commented 5 years ago

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 commented 5 years ago

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))

kattni commented 5 years ago

@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 commented 5 years ago

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