Skip to content

Commit

Permalink
Represent missing elevation data as 0 rather than nan
Browse files Browse the repository at this point in the history
Resolves: dodo-saba#15
  • Loading branch information
mbacchi committed Aug 6, 2024
1 parent a0079cb commit c11cebc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fit2gpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pandas as pd
import gpxpy.gpx
import fitdecode
from math import isnan


# MAIN CONVERTER CLASS
Expand Down Expand Up @@ -175,6 +176,8 @@ def dataframe_to_gpx(self, df_points, col_lat='latitude', col_long='longitude',

# Step 3: Add points from dataframe to GPX track:
for idx in df_points.index:
if isnan(df_points.loc[idx, col_alt]):
df_points.loc[idx, col_alt] = 0
# Create trackpoint:
track_point = gpxpy.gpx.GPXTrackPoint(
latitude=df_points.loc[idx, col_lat],
Expand Down

0 comments on commit c11cebc

Please sign in to comment.