[GIS] How to add elevation data to a GeoJSON line from a GPX file

elevationgdalgeojsongpxleaflet

I understand that elevation can be added as an optional third value in Coordinates (lat, long, elev) in a geojson file, but I can't find a way to actually do that from a gpx file. I've used ogr2ogr to convert gpx to geojson. I've also loaded the gpx file into QGIS and saved as a geojson file, but neither method brings in elevation when I do this to the gpx tracks. It will bring in elevation as a Property if I convert the points, but I need a line. Ultimately, I want to diplay these lines in Leaflet and build elevation profiles for them. Is there any easy way to do this other than parsing out the gpx files and building my own geojson files?

Best Answer

You can create or import routes on bikemap.net. After that, export them as GPX, load the GPX file in geojson.io, and save it as GeoJSON. You can add as many GPX files as you want to a single GeoJSON.