-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when gpx contains Waypoints #107
Comments
Hmm, that's weird, it should already correctly handle this. This is how waypoints are parsed: el = xml.getElementsByTagName('wpt');
for (i = 0; i < el.length; i++) {
var ll = new L.LatLng(
el[i].getAttribute('lat'),
el[i].getAttribute('lon'));
var nameEl = el[i].getElementsByTagName('name');
var name = nameEl.length > 0 ? nameEl[0].textContent : null;
var descEl = el[i].getElementsByTagName('desc');
var desc = descEl.length > 0 ? descEl[0].textContent : null;
var symEl = el[i].getElementsByTagName('sym');
var symKey = symEl.length > 0 ? symEl[0].textContent : null;
var typeEl = el[i].getElementsByTagName('type');
var typeKey = typeEl.length > 0 ? typeEl[0].textContent : null;
// ...
} As you can see, I just call Can you confirm you are using the latest version of leaflet-gpx, and share your code snipped and source GPX file so I can reproduce? |
I had the same problem using v1.5.1 and a .gpx file that includes a waypoint (but no This was not a problem with v1.5.0 - even without the I can try to work up an example if that would help. |
It is working if I change |
@jengalas Thanks! The |
When I use gpx with route, everything works fine.
when I add at least one waypoint I get error and maps is not shown even with route:
Uncaught TypeError: Cannot read property 'length' of null
at i._parse_gpx_data (VM463 gpx.min.js:formatted:366)
at i (VM463 gpx.min.js:formatted:293)
at XMLHttpRequest.o.onreadystatechange (VM463 gpx.min.js:formatted:286)
I used this, maybe there are some more mandatory parameters that are missing?
<wpt lat="xxx" lon="yyy"> <name>Name</name> </wpt>
Just check some other waypoints from the Issues, it turned out that
<desc>
is needed, but according to gpx specification it is not mandatoryhttps://www.topografix.com/gpx_manual.asp
The text was updated successfully, but these errors were encountered: