Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong distance? 10.4 km instead of 7.6 km #259

Closed
introspectionism opened this issue May 14, 2023 · 1 comment
Closed

Wrong distance? 10.4 km instead of 7.6 km #259

introspectionism opened this issue May 14, 2023 · 1 comment

Comments

@introspectionism
Copy link

introspectionism commented May 14, 2023

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.

20230514211233_386x99


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
Copy link
Owner

tkrajina commented Jun 3, 2023

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.

@tkrajina tkrajina closed this as completed Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants