Closed micolous closed 8 years ago
I'm aware of this. For my own usage this loss of precision is not a big deal but agree that for some use-cases this may be important.
Anyway, instead of changing the to_numeric
function, I thinks it is better to change the parser in the gpx-1.1
since I rewrote the parser there and I plan to merge it to master. I think I'll use float()
by default and decimal.Decimal
only when the user needs it.
It appears in https://github.com/tkrajina/gpxpy/blob/master/gpxpy/utils.py#L58, the
to_numeric
function uses the built-infloat
to convert astr
to a numeric value.As a result, the latitude and longitude loses precision, and the amount of precision lost is dependent on the Python implementation.
Instead, this should use
decimal.Decimal
, which has a fixed precision.