adafruit / Adafruit_CircuitPython_GPS

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

Add handling with extra precision in lat/long #80

Closed gamblor21 closed 2 years ago

gamblor21 commented 2 years ago

Addresses issue #63 by adding two new latitude and two new longitude attributes for degrees and minutes. When combined as one value the current CP float limit cannot handle the full precision of latitude or longitude.

The _parse_degrees function was modified to give more precision to the existing latitude and longitude values (some was lost in the calculation not in the final storage) but that value is still imprecise.

caternuson commented 2 years ago

@dhalbert lgtm. seems like idea is _degrees and _minutes provide integer values to avoid potential precision issue when converting to single latitude float value? could maybe have something like a named tuple instead of two separate variables? but probably not worth the extra effort.

gamblor21 commented 2 years ago

@dhalbert lgtm. seems like idea is _degrees and _minutes provide integer values to avoid potential precision issue when converting to single latitude float value? could maybe have something like a named tuple instead of two separate variables? but probably not worth the extra effort.

That is the idea behind it. Float just does not have the precision required to hold all the information. I saw something else use a tuple later but that is my lack of python experience showing through.