commit a19d14438a0b2fa1bd32b226cb81cf3471c08798
parent da47dd99b35106e59b855e8b275fd8a81fe77d3f
Author: myadzel <myadzel@gmail.com>
Date: Tue, 5 Jun 2018 12:01:26 +0300
add time element inside of trkpt element (gpx compatibility to garmin connect)
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/leaflet.control.track-list/lib/geo_file_exporters.js b/src/lib/leaflet.control.track-list/lib/geo_file_exporters.js
@@ -4,7 +4,8 @@ import {saveNktk} from './nktk';
function saveGpx(segments, name, points) {
var gpx = [],
- x, y;
+ x, y,
+ time = new Date(0).toISOString();
gpx.push('<?xml version="1.0" encoding="UTF-8" standalone="no" ?>');
gpx.push(
@@ -32,7 +33,8 @@ function saveGpx(segments, name, points) {
points.forEach(function(p) {
x = p.lng.toFixed(6);
y = p.lat.toFixed(6);
- gpx.push('\t\t\t<trkpt lat="' + y + '" lon="' + x + '"></trkpt>');
+ //time element is not necessary, added for compatibility to Garmin Connect only
+ gpx.push('\t\t\t<trkpt lat="' + y + '" lon="' + x + '"><time>' + time + '</time></trkpt>');
}
);
gpx.push('\t\t</trkseg>');