Comments (2)
Yes, it is definitely not handling the case where the default namespace is not http://www.topografix.com/GPX/1/1. That seems to be a bug to me. In fact, even ElementTree by default will use ns0 for http://www.topografix.com/GPX/1/1 and no default namespace. It is valid.
I fixed it by using ElementTree to parse the file after setting the default namespace to be http://www.topografix.com/GPX/1/1 and then passing the resulting XML to gpxpy.parse.
import xml.etree.ElementTree as ET
# Ensure GPX/1/1 is the default namespace
ET.register_namespace('', "http://www.topografix.com/GPX/1/1")
tree = ET.parse(file_name)
root = tree.getroot();
xml = ET.tostring(root, encoding='unicode');
# Parse the xml string
gpx = gpxpy.parse(xml)
from gpxpy.
I'm having a perhaps similar problem. Converting garmin fit files to gpx results in:
<gpx version="1.1" creator="GPSBabel - https://www.gpsbabel.org" xmlns="http://www.topografix.com/GP
X/1/1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmi
n.com/xmlschemas/TrackPointExtension/v1">
and have trkpt looking like
<trkpt lat="34.405181017" lon="-119.842143841">
<ele>-4.200</ele>
<time>2022-02-15T22:12:26Z</time>
<extensions>
<gpxtpx:TrackPointExtension>
<gpxtpx:atemp>20.000000</gpxtpx:atemp>
<gpxtpx:hr>153</gpxtpx:hr>
</gpxtpx:TrackPointExtension>
</extensions>
</trkpt>
and after parsing segment points have an empty extensions field.
from gpxpy.
Related Issues (20)
- coordinate bounding box HOT 2
- metadata error in bounds HOT 1
- Force stdlib etree instead of lxml? HOT 1
- Uphill Downhill are not accurate HOT 2
- GPX parsing not working with extension HOT 2
- NameError: free variable 'from_start_to_end' referenced before assignment in enclosing scope HOT 1
- Setup.py method is being deprecated in python package
- Confusion!
- Wrong distance? 10.4 km instead of 7.6 km HOT 1
- Save nsmap of GPX in GPXTrack, GPXTrackSegment and GPXTrackPoint
- GPX track all messed up HOT 1
- Tag a release to ship improvements since 1.5.0 HOT 1
- TypeError in gpxfield since 1.6.0 release HOT 1
- Changes Backported To 1.5.0 HOT 2
- Typo in __repr__ of SimpleTZ HOT 1
- [newbie] Wrong return type on GPXTrackSegment.get_duration() HOT 1
- create CI testing scripts HOT 1
- feature request: include distance_from_start in NearestLocationsData class HOT 1
- Is Header malformed
- Check for GPX root node on parse HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpxpy.