-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use gpxpy 'ns-namespace' branch to fix: tkrajina/gpxpy#117
- Loading branch information
Showing
6 changed files
with
91 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<gpx creator="Garmin Connect" version="1.1" | ||
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/11.xsd" | ||
xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" | ||
xmlns="http://www.topografix.com/GPX/1/1" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3"> | ||
<metadata> | ||
<link href="connect.garmin.com"> | ||
<text>Garmin Connect</text> | ||
</link> | ||
<time>2018-02-21T14:30:50.000Z</time> | ||
</metadata> | ||
<trk> | ||
<name>Foo Bar</name> | ||
<type>running</type> | ||
<trkseg> | ||
<trkpt lat="51.43788929097354412078857421875" lon="6.617012657225131988525390625"> | ||
<ele>23.6000003814697265625</ele> | ||
<time>2018-02-21T14:30:50.000Z</time> | ||
<extensions> | ||
<ns3:TrackPointExtension> | ||
<ns3:hr>125</ns3:hr> | ||
<ns3:cad>75</ns3:cad> | ||
</ns3:TrackPointExtension> | ||
</extensions> | ||
</trkpt> | ||
<trkpt lat="51.43786800093948841094970703125" lon="6.6170061193406581878662109375"> | ||
<ele>23.6000003814697265625</ele> | ||
<time>2018-02-21T14:30:51.000Z</time> | ||
<extensions> | ||
<ns3:TrackPointExtension> | ||
<ns3:hr>123</ns3:hr> | ||
<ns3:cad>75</ns3:cad> | ||
</ns3:TrackPointExtension> | ||
</extensions> | ||
</trkpt> | ||
<trkpt lat="51.4378472976386547088623046875" lon="6.61700570024549961090087890625"> | ||
<ele>23.799999237060546875</ele> | ||
<time>2018-02-21T14:30:52.000Z</time> | ||
<extensions> | ||
<ns3:TrackPointExtension> | ||
<ns3:hr>124</ns3:hr> | ||
<ns3:cad>75</ns3:cad> | ||
</ns3:TrackPointExtension> | ||
</extensions> | ||
</trkpt> | ||
</trkseg> | ||
</trk> | ||
</gpx> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
from pathlib import Path | ||
|
||
# https://github.com/jedie/django-for-runners | ||
from for_runners.gpx import parse_gpx_file | ||
|
||
BASE_PATH = Path(__file__).parent | ||
|
||
|
||
class GpxTests(unittest.TestCase): | ||
|
||
def test_parse_gpx(self): | ||
filepath = Path(BASE_PATH, "fixture_files/garmin_connect_1.gpx") | ||
|
||
gpxpy_instance = parse_gpx_file(filepath) | ||
|
||
first_point = gpxpy_instance.tracks[0].segments[0].points[0] | ||
self.assertEqual(first_point.latitude, 51.43788929097354412078857421875) | ||
self.assertEqual(first_point.longitude, 6.617012657225131988525390625) | ||
|
||
extensions = first_point.extensions | ||
self.assertEqual(1, len(extensions)) | ||
self.assertEqual(extensions[0].getchildren()[0].text.strip(), "125") # hr | ||
self.assertEqual(extensions[0].getchildren()[1].text.strip(), "75") # cad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters