Closed bosby74 closed 4 years ago
Adding waypoints to the track works for me:
$ ipython
In [1]: import gpxpy.gpx as g
In [2]: gpx = g.GPX()
In [3]: gpx.waypoints.append(g.GPXWaypoint())
In [5]: gpx.waypoints.append(g.GPXWaypoint(1, 2))
In [7]: print(gpx.to_xml())
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="gpx.py -- https://github.com/tkrajina/gpxpy">
<wpt lat="0" lon="0">
</wpt>
<wpt lat="1" lon="2">
</wpt>
</gpx>
Unfortunately, I don't have the time to debug your example. If you can send me a minimal example (including a minimal GPX file, if needed), I'll revisit the issue.
Dear, thank you for your answer. After your suggestion I tried several combinations but it seems that the problem arises trying to write the gpx object as a gpx output file. In fact the waypoint appears on the gpx object just created but it disappears once use gpx.to_xml() to save the result in the output file. I send you the python script and the input file that I'm using and the output file produced. Let me know for any suggestion about it. Thank you, Simone waypoint_issue.zip
Dear, I'm a new user of gpxpy (and honestly not a very proficient user of python too) and I'm trying to build a code to read a gpx file, add a waypoint and write it to a new gpx file. The code that I wrote is:
but the output that is produced doesn't contain any waypoints but only track points. Someone have an idea for the reason? Does gpxpy allow to write waypoints? and does gpxpy allow to write gpx output file?
Thanks in advance, Simone