tkrajina/gpxpy

How To Input TimeStamp Attribute Into The GPX File

Closed this issue · 1 comments

I'm trying to generate a .GPX file by using a GPS module (Neo-6m) connected to my Raspi. I can retrieve all the data from my GPS successfully. Now I want my gpx file track points to include lat, long, alt, and timestamp. I can do with the first three, but I can't find any documentation for the timestamp.

Can someone please help me out? How do I enter the timestamp into the gpx file that's been retrieved from the GPS module on Raspberry Pi?

GPX file sample from phone recorded track point:

<trkpt lat="31.2378700" lon="121.4926130">
    <ele>2.0</ele>
    <time>2017-06-25T10:10:30Z</time>
    <extensions>
     <gpxtpx:TrackPointExtension>
      <gpxtpx:hr>131</gpxtpx:hr>
     </gpxtpx:TrackPointExtension>
    </extensions>
</trkpt>

pt = GPXTrackPoint(); pt.time = datetime.datetime(2017,6,25,10,10,30)