Wrong distance? 10.4 km instead of 7.6 km
introspectionism opened this issue · 1 comments
introspectionism commented
gpxpy 1.5.0
python 3.10.10
I have a GPX file containing one track of a distance of 7.6 km. However, when I run gpxpy on the file, I am given a distance of 10384.55 meters. Either I am doing something wrong, or the distance is way off.
print(gpx.get_moving_data(raw=False))
:
MovingData(moving_time=3754.0, stopped_time=96.0, moving_distance=10375.664734768896, stopped_distance=8.883521461788082, max_speed=3.698183125114228)
moving_data = gpx.get_moving_data(raw=False) # I have tried False and True here
distance = moving_data.moving_distance + moving_data.stopped_distance
print(distance)
10384.548256230684
tkrajina commented
It's not wrong. gpxpy calculates two types of distances, 2D and 3D. Here they are for your track:
Length 2D: 7.631km
Length 3D: 10.385km
I uploaded now your track in google maps and it says:
Thursday, May 11, 2023, 3:54 PM AZOST
Distance: 4.7 miles
Duration: 1 hours, 4 minutes, and 11 seconds
Average Speed: 4.4 mph
Minimum Elevation: 807 feet
Maximum Elevation: 1502 feet
Total climb: 1237 feet
Total descent: 1196 feet
4.7 miles is approx 7.5km which is gpxpy's 2d distance.