add all waypoints and the endpoint
This commit is contained in:
parent
e18added04
commit
85de91c668
@ -74,7 +74,9 @@ function toWGS84(point) {
|
|||||||
*/
|
*/
|
||||||
function trackTitle(geoJson) {
|
function trackTitle(geoJson) {
|
||||||
const route = geoJson.segments[0];
|
const route = geoJson.segments[0];
|
||||||
return `${geoJson.book_route_number}-${route.route_id} ${route.title}`;
|
const book = geoJson.book_route_number ? `${geoJson.book_route_number}-` : "";
|
||||||
|
|
||||||
|
return `${book}${route.route_id} ${route.title}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,6 +92,11 @@ function toGpx(geoJson) {
|
|||||||
</trkseg>`;
|
</trkseg>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
|
|
||||||
|
let endPoint = geoJson.end_point ? toWayPoint(geoJson.end_point) : "";
|
||||||
|
let waypoints = geoJson.waypoints ? geoJson.waypoints.map(wp => {
|
||||||
|
return toWayPoint(wp.reference_poi);
|
||||||
|
}).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" ?>
|
||||||
@ -101,6 +108,8 @@ function toGpx(geoJson) {
|
|||||||
creator="SAC-Tourenportal GPX Downloader">
|
creator="SAC-Tourenportal GPX Downloader">
|
||||||
${toWayPoint(geoJson.departure_point)}
|
${toWayPoint(geoJson.departure_point)}
|
||||||
${toWayPoint(geoJson.destination_poi)}
|
${toWayPoint(geoJson.destination_poi)}
|
||||||
|
${waypoints}
|
||||||
|
${endPoint}
|
||||||
<trk>
|
<trk>
|
||||||
<name>Track ${routeTitle}</name>
|
<name>Track ${routeTitle}</name>
|
||||||
${trackSegments}
|
${trackSegments}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "SAC Route Portal GPX Downloader",
|
"name": "SAC Route Portal GPX Downloader",
|
||||||
"version": "0.4",
|
"version": "0.5",
|
||||||
"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