Format KML

This commit is contained in:
Norbert Renner 2021-04-01 11:53:17 +02:00
parent 7caa7aeba6
commit 00f2cead36
7 changed files with 246 additions and 77 deletions

View file

@ -4,6 +4,7 @@ turf = require('@turf/turf');
togpx = require('togpx');
require('leaflet');
require('../../js/format/VoiceHints.js');
require('../../js/format/Xml.js');
require('../../js/format/Gpx.js');
const fs = require('fs');
@ -48,14 +49,14 @@ test('simple track', () => {
});
test('waypoints', () => {
const brouterGpx = BR.Gpx.pretty(read('waypoints.gpx'));
const brouterGpx = BR.Xml.pretty(read('waypoints.gpx'));
const gpx = BR.Gpx.format(waypointsGeoJson, 5);
expect(gpx).toEqual(brouterGpx);
});
describe('voice hints', () => {
test('2-locus', () => {
let brouterGpx = BR.Gpx.pretty(read('2-locus.gpx'));
let brouterGpx = BR.Xml.pretty(read('2-locus.gpx'));
brouterGpx = brouterGpx.replace(/\n\s*<\/extensions>\n\s*<extensions>/, ''); // ignore (invalid) double tag
// ignore float rounding differences
brouterGpx = brouterGpx.replace(
@ -68,7 +69,7 @@ describe('voice hints', () => {
});
test('3-osmand', () => {
const brouterGpx = BR.Gpx.pretty(read('3-osmand.gpx', false));
const brouterGpx = BR.Xml.pretty(read('3-osmand.gpx', false));
const gpx = BR.Gpx.format(geoJson, 3);
expect(gpx).toEqual(brouterGpx);
});
@ -88,7 +89,7 @@ describe('voice hints', () => {
});
test('6-orux', () => {
let brouterGpx = BR.Gpx.pretty(read('6-orux.gpx'));
let brouterGpx = BR.Xml.pretty(read('6-orux.gpx'));
const gpx = BR.Gpx.format(geoJson, 6);
expect(gpx).toEqual(brouterGpx);
});