tkrajina / gpxpy

gpx-py is a python GPX parser. GPX (GPS eXchange Format) is an XML based file format for GPS tracks.
Apache License 2.0
1.01k stars 223 forks source link

Allow user to enforce Haversine distance #233

Open WPettersson opened 3 years ago

WPettersson commented 3 years ago

I've noticed some of my distance measurements have been not quite right, and after some investigation I've realised that it's down to gpxpy using the simpler distance calculations that ignore the curvature of the Earth. I realise that this is on purpose, to avoid taxing calculations (see issue #9), but I'd like to at least be able to configure when it is used. For my use-case, computational load is not a concern, so I'd actually prefer to always use the haversine distance.

I'm happy to try to code this up myself, but was wondering how you think it best to include something like this. One option I thought might work would be to add a haversine option to the parse function, but it could also be a module-wide setting like gpxpy.haversineMinDistance = 0 to disable the cheaper computation and always use the haversine distance formula.