version 0.4: add all route segments to gpx file
This commit is contained in:
parent
8eed835aa2
commit
e18added04
@ -84,7 +84,12 @@ function trackTitle(geoJson) {
|
||||
* @returns Simple gpx string.
|
||||
*/
|
||||
function toGpx(geoJson) {
|
||||
const route = geoJson.segments[0].geom;
|
||||
let trackSegments = geoJson.segments.map(segment => {
|
||||
return `<trkseg>
|
||||
${segment.geom.coordinates.map(toTrackPoint).join("")}
|
||||
</trkseg>`;
|
||||
}).join("");
|
||||
|
||||
const routeTitle = trackTitle(geoJson);
|
||||
|
||||
const xmlString = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
@ -98,9 +103,7 @@ function toGpx(geoJson) {
|
||||
${toWayPoint(geoJson.destination_poi)}
|
||||
<trk>
|
||||
<name>Track ${routeTitle}</name>
|
||||
<trkseg>
|
||||
${route.coordinates.map(toTrackPoint).join("")}
|
||||
</trkseg>
|
||||
${trackSegments}
|
||||
</trk>
|
||||
</gpx>
|
||||
`;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "SAC Route Portal GPX Downloader",
|
||||
"version": "0.3",
|
||||
"version": "0.4",
|
||||
"developer": {
|
||||
"name": "Sebastian Hugentobler",
|
||||
"url": "https://code.vanwa.ch/sebastian/sac-route-portal-gpx-fx"
|
||||
|
Loading…
Reference in New Issue
Block a user