tkrajina / gpxgo

GPX library for golang
Apache License 2.0
94 stars 23 forks source link

GPX files from Zepp App fail validation #20

Closed karololszacki closed 1 year ago

karololszacki commented 1 year ago

GPX files generated with Zepp App (formerly Amazfit, a Xiaomi sub-brand) fail the validation. The guessGPXVersion function assumes it's a GPX format 7.7, which does not exist - when it's just the Zepp App version...

The file looks like this:

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<gpx xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:ns1="http://www.cluetrust.com/XML/GPXDATA/1/0" creator="Zepp App" version="7.7.5-play">
    <trk>
        <name><![CDATA[20230522 Jazda na rowerze]]></name>
        <trkseg>
            <trkpt lat="51.140266" lon="17.026491">
                <ele>182.0</ele>
                <time>2023-05-22T14:16:07Z</time>
                <desc><![CDATA[CommonTimeValuePoint(absoluteTime=1684764967, value=0.23148148)]]></desc>
                    <extensions>
                        <ns3:TrackPointExtension>
                            <ns3:speed>4.347826</ns3:speed>
                            <ns3:cad>0.0</ns3:cad>
                            <ns3:hr>125</ns3:hr>
                        </ns3:TrackPointExtension>
                    </extensions>
            </trkpt>
            <trkpt lat="51.14024" lon="17.026417">
                <ele>182.0</ele>
                <time>2023-05-22T14:16:08Z</time>
                <desc><![CDATA[CommonTimeValuePoint(absoluteTime=1684764968, value=0.19417475)]]></desc>
                    <extensions>
                        <ns3:TrackPointExtension>
                            <ns3:speed>5.263158</ns3:speed>
                            <ns3:cad>0.0</ns3:cad>
                            <ns3:hr>125</ns3:hr>
                        </ns3:TrackPointExtension>
                    </extensions>
            </trkpt>
            <trkpt lat="51.14021" lon="17.026342">
                <ele>182.0</ele>
                <time>2023-05-22T14:16:09Z</time>
                <desc><![CDATA[CommonTimeValuePoint(absoluteTime=1684764969, value=0.19417475)]]></desc>
                    <extensions>
                        <ns3:TrackPointExtension>
                            <ns3:speed>5.263158</ns3:speed>
                            <ns3:cad>0.0</ns3:cad>
                            <ns3:hr>126</ns3:hr>
                        </ns3:TrackPointExtension>
                    </extensions>
            </trkpt>
        </trkseg>
    </trk>
</gpx>

Error is: Invalid version: 7.7

tkrajina commented 1 year ago

Fixed in v1.3.1, thanks for reporting the bug.