From e18added0473153f025b5587dc7ff7f1f64b3968 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 16 Jun 2021 12:42:39 +0200 Subject: [PATCH] version 0.4: add all route segments to gpx file --- background.js | 11 +++++++---- manifest.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/background.js b/background.js index 6c7dc24..e60dbe0 100644 --- a/background.js +++ b/background.js @@ -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 ` + ${segment.geom.coordinates.map(toTrackPoint).join("")} + `; + }).join(""); + const routeTitle = trackTitle(geoJson); const xmlString = ` @@ -98,9 +103,7 @@ function toGpx(geoJson) { ${toWayPoint(geoJson.destination_poi)} Track ${routeTitle} - - ${route.coordinates.map(toTrackPoint).join("")} - + ${trackSegments} `; diff --git a/manifest.json b/manifest.json index c63b54c..5dbcacf 100644 --- a/manifest.json +++ b/manifest.json @@ -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"