add gpx route parsing

merge-requests/1/head
Julien Veyssier 2016-12-08 10:46:36 +01:00
parent 047cf1b1cd
commit b051fe1e40
2 changed files with 22 additions and 3 deletions

View File

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[#6](https://gitlab.com/eneiluj/gpxedit-oc/issues/6) @eneiluj
- symbol selects include icons
[#6](https://gitlab.com/eneiluj/gpxedit-oc/issues/6) @eneiluj
- gpx route parsing
### Changed
- detach marker and tooltip styling option

View File

@ -581,9 +581,9 @@ function parseGpx(xml){
});
dom.find('trk').each(function(){
var latlngs = [];
var name = $(this).find('name').text();
var cmt = $(this).find('cmt').text();
var desc = $(this).find('desc').text();
var name = $(this).find('>name').text();
var cmt = $(this).find('>cmt').text();
var desc = $(this).find('>desc').text();
$(this).find('trkseg').each(function(){
$(this).find('trkpt').each(function(){
var lat = $(this).attr('lat');
@ -599,6 +599,24 @@ function parseGpx(xml){
});
drawLine(latlngs, name, desc, cmt);
});
dom.find('rte').each(function(){
var latlngs = [];
var name = $(this).find('>name').text();
var cmt = $(this).find('>cmt').text();
var desc = $(this).find('>desc').text();
$(this).find('rtept').each(function(){
var lat = $(this).attr('lat');
var lon = $(this).attr('lon');
var ele = $(this).find('ele').text();
if (ele !== ''){
latlngs.push([lat,lon,ele]);
}
else{
latlngs.push([lat,lon]);
}
});
drawLine(latlngs, name, desc, cmt);
});
}
// remove layers from map and delete all layers data