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.
|
* @returns Simple gpx string.
|
||||||
*/
|
*/
|
||||||
function toGpx(geoJson) {
|
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 routeTitle = trackTitle(geoJson);
|
||||||
|
|
||||||
const xmlString = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
const xmlString = `<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
@ -98,9 +103,7 @@ function toGpx(geoJson) {
|
|||||||
${toWayPoint(geoJson.destination_poi)}
|
${toWayPoint(geoJson.destination_poi)}
|
||||||
<trk>
|
<trk>
|
||||||
<name>Track ${routeTitle}</name>
|
<name>Track ${routeTitle}</name>
|
||||||
<trkseg>
|
${trackSegments}
|
||||||
${route.coordinates.map(toTrackPoint).join("")}
|
|
||||||
</trkseg>
|
|
||||||
</trk>
|
</trk>
|
||||||
</gpx>
|
</gpx>
|
||||||
`;
|
`;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "SAC Route Portal GPX Downloader",
|
"name": "SAC Route Portal GPX Downloader",
|
||||||
"version": "0.3",
|
"version": "0.4",
|
||||||
"developer": {
|
"developer": {
|
||||||
"name": "Sebastian Hugentobler",
|
"name": "Sebastian Hugentobler",
|
||||||
"url": "https://code.vanwa.ch/sebastian/sac-route-portal-gpx-fx"
|
"url": "https://code.vanwa.ch/sebastian/sac-route-portal-gpx-fx"
|
||||||
|
Loading…
Reference in New Issue
Block a user