At this moment I am experimenting with reading GPX files, so far I have exported runs from my sports tracker app and I have managed to load these correctly and plotted them on a map.
Now I have drawn a new route in my app and exported this into a .gpx file, however when I try loading this in R I get the following error:
Error in nm[[1]] : subscript out of bounds
R code :
library(plotKML)
library(leaflet)
route <- readGPX("../GPS data Serge/Testing.gpx", tracks = TRUE)
Testing.gpx file :
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Endomondo.com" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata>
<author>
<name>Wouter Baeckelmans</name>
</author>
<link href="http://www.endomondo.com">
<text>Endomondo</text>
</link>
<time>2015-12-02T15:53:31Z</time>
</metadata>
<trk>
<name>Test</name>
<src>http://www.endomondo.com/</src>
<link href="https://www.endomondo.com/routes/639589549">
<text>Test</text>
</link>
<type>RUNNING</type>
<trkseg>
<trkpt lat="8.39087" lon="-12.94756"/>
<trkpt lat="8.39022" lon="-12.94777"/>
<trkpt lat="8.38974" lon="-12.94861"/>
<trkpt lat="8.38307" lon="-12.94227"/>
<trkpt lat="8.38248" lon="-12.94181"/>
<trkpt lat="8.3822" lon="-12.94171"/>
<trkpt lat="8.38104" lon="-12.94155"/>
<trkpt lat="8.3765" lon="-12.94101"/>
<trkpt lat="8.37593" lon="-12.94086"/>
<trkpt lat="8.37556" lon="-12.94065"/>
<trkpt lat="8.37522" lon="-12.9404"/>
<trkpt lat="8.3742" lon="-12.93948"/>
<trkpt lat="8.37367" lon="-12.93893"/>
<trkpt lat="8.37305" lon="-12.93819"/>
</trkseg>
</trk>
</gpx>
Any idea's on what could be causing this? I noticed this .gpx files looks different than the other .gpx file that I could load succesfully. That file contained a trkseg
tag for each trkpt
tag...
But I think it should be possible to load this file as well, I just don't seem to find how.
Any help on this is greatly appreciated!