I have a GeoPandas geodataframe with LineString geometries and I'd like to export them into .gpx files as GPS routes.

I've searched for hints in the web but found anything useful.

Are there GeoPandas specific way to do this or from other packages like Shapely?

  • 1
    You only need to save your GeoPandas geodataframe, with 'to_file' method, by using 'GPX' driver.
    – xunilk
    Jan 13 '17 at 12:51

To test my approach, I loaded a shapefile as GeoPandas geodataframe and, afterwards, I saved it as gpx file. This is the code:

import geopandas as gpd

lines = gpd.read_file('/home/zeito/pyqgis_data/my_lines.shp')

lines.to_file('/home/zeito/pyqgis_data/my_lines.gpx', 'GPX')

When gpx layer is loaded at Map Canvas, it could be observed that it works perfectly.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.