erik / derive

Generate personal heatmap from GPX/TCX/FIT/IGC data
https://erik.github.io/derive
MIT License
497 stars 63 forks source link

Handling of <trkseg> #46

Closed taob closed 4 years ago

taob commented 4 years ago

It appears that an empty <trkseg></trkseg> block stops the parser from reading the rest of the GPX file. Also, the progress meter appears to reference the number of <trkseg> blocks rather than the number of files being processed.

20200929-123021

erik commented 4 years ago

Thanks for the heads up @taob!

Would you be able to share an an example GPX file that has this issue?

erik commented 4 years ago

Also - I have a quick guess at a fix, could you see if your issue persists when using this build?

https://deploy-preview-47--quizzical-ride-bfb8af.netlify.app/

taob commented 4 years ago

Confirmed that the fix works! Tried four files on the public interface, 3 of 4 files reported failures.

20200930-132121

Tried same four files on the new build: no errors, and all the routes loaded!

taob commented 4 years ago

For reference, the problematic GPX files all start like this. Track points up to the empty <trkseg> block are parsed, but nothing after it. In this example, there are no points before the empty block, so nothing shows up on the map.

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Urban Biker - with barometer" 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/v2 http://www.garmin.com/xmlschemas/TrackPointExtensionv2.xsd" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v2" xmlns:gpxpx="http://www.garmin.com/xmlschemas/PowerExtensionv1.xsd" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<metadata>
<link href="http://www.urban-bike-computer.com/">
<text>Urban Biker</text>
</link>
<time>2018-11-10T19:10:57.470Z</time>
</metadata>

<trk>
<name>Urban Biker – Giant Roam 2 – Nov 10, 2018 14:10</name>
<trkseg>
</trkseg>
<trkseg>
<trkpt ...
erik commented 4 years ago

Thanks @taob!