Request for demo / feature to write .gpx files with extensions
chabanr opened this issue ยท 4 comments
Hi,
I love this package so far to parse and mix-n-match data from my different devices.
I am trying to pull GPS data from a GPX file, take heart rate data from a separate (.tcx) file and combine them to write a single .gpx file with the GPS data and the heart rate data combined that I can then re-upload to Strava.
I am very much an amateur programmer and I have been able to do everything to pair up the HR data but I cannot figure out how to WRITE the HR data as an extension in the .gpx file. (I can write an extensionless file just fine)
I've read the READEME:
gpx.py preserves GPX extensions. They are stored as ElementTree DOM objects. Extensions are part of GPX 1.1, and will be ignored when serializing a GPX object in a GPX 1.0 file.
which I believe has more to do with reading the files but to be completely honest I didn't understand much when I started researching that. I've also read the other issues and saw the request to expand the read_extensions API but nothing about how to more easily write them.
Would it be possible for you to write a more extensive demo on how to write a .gpx file with GPS locations AND extensions on each point?
Thank you!
-R
Dear Tomo and chabanr,
I very much support the comment&request of chabanr! I have a very similar if not the same intent and problem. In my case, I would like to save all kind of sensor data (meteo, radioactivity) coming from a RPi to a GPX files to create nice colored traces. I was thinking of either "abusing" fields like heartrate
or properly using extensions.
After downloading and testing gpxpy I find it does nearly everything needed, but I didn't understand how the extensions can be used (i.e.: added to a point), even after looking to the code and even bravely trying some changes there.
It would be very helpful for me to see an extension value used (=written) in the nice example code.
Thanks a lot for gpxpy and your help - Frederik!
Hi @farbeiter and @chabanr first of all, yes, I absolutely agree that the documentation lacks this example. I'll try to do it in the following weeks (although, a pull-request would also be welcome ๐). Unfortunately the time remaining for open-source is pretty scarce :(
Anyway, an even better solution would be to build a plugin-system or an api like #119
Sadly i'm not able to contribute due to lack of coding skill, but i skipped using gpxpy for exactly this reason and wrote my own parser which basically just dumped all namespaces. That's far from flexible so i won't recommend it. But yes, i too, would welcome any PR/examples about this. Gpxpy is great work, regardless! :)