Converting and Saving

Converting to Dataframe

The to_pandas() method allows to convert a GPX object to a Pandas Dataframe.

from ezgpx import GPX

# Parse GPX file
gpx = GPX("file.gpx")

# Do stuff with GPX object

# Convert to Pandas Dataframe
df = gpx.to_pandas(values=["lat", "lon", "ele"])

The to_polars() method allows to convert a GPX object to a Polars Dataframe.

from ezgpx import GPX

# Parse GPX file
gpx = GPX("file.gpx")

# Do stuff with GPX object

# Convert to Pandas Dataframe
df = gpx.to_polars(values=["lat", "lon", "ele"])

Saving as GPX File

The to_gpx() method allows to export a GPX object as a GPX file.

from ezgpx import GPX

# Parse GPX file
gpx = GPX("file.gpx")

# Do stuff with GPX object

# Save as GPX file
gpx.to_gpx("new_file.gpx")

Saving as KML File

The to_kml() method allows to export a GPX object as a KML file.

from ezgpx import GPX

# Parse GPX file
gpx = GPX("file.gpx")

# Do stuff with GPX object

# Save as KML file
gpx.to_kml("new_file.kml")

Saving as CSV File

The to_csv() method allows to export a GPX object as a CSV file.

from ezgpx import GPX

# Parse GPX file
gpx = GPX("file.gpx")

# Do stuff with GPX object

# Save as CSV file
gpx.to_csv("new_file.csv", values=["lat", "lon", "ele"])