keep elevation in loaded waypoints, write elevation in saved waypoints

merge-requests/1/head
Julien Veyssier 2016-12-05 13:09:28 +01:00
parent ad5ad0e644
commit f6af95223e
1 changed files with 11 additions and 1 deletions

View File

@ -313,6 +313,7 @@ function generateGpx(){
if (layer.type === 'marker'){
var lat = layer._latlng.lat;
var lng = layer._latlng.lng;
var alt = layer._latlng.alt;
gpxText = gpxText + ' <wpt lat="'+lat+'" lon="'+lng+'">\n';
if (name){
gpxText = gpxText + ' <name>'+name+'</name>\n';
@ -320,6 +321,9 @@ function generateGpx(){
else{
gpxText = gpxText + ' <name>unnamed</name>\n';
}
if (alt !== undefined){
gpxText = gpxText + ' <ele>'+alt+'</ele>\n';
}
if (comment){
gpxText = gpxText + ' <cmt>'+comment+'</cmt>\n';
}
@ -398,7 +402,13 @@ function parseGpx(xml){
var name = $(this).find('name').text();
var cmt = $(this).find('cmt').text();
var desc = $(this).find('desc').text();
drawMarker([lat, lon], name, desc, cmt);
var ele = $(this).find('ele').text();
if (ele !== ''){
drawMarker([lat, lon, ele], name, desc, cmt);
}
else{
drawMarker([lat, lon], name, desc, cmt);
}
});
$(dom).find('trk').each(function(){
var latlngs = [];