From ca608bbb993bec29c32a54965305f6a427d806d2 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 26 May 2021 20:17:35 +0100 Subject: [PATCH] =?UTF-8?q?lib/build-trajectory:=20fix=20bugs=20&=20edge?= =?UTF-8?q?=20cases=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The algorithm is still not perfect. Once https://github.com/ad-freiburg/pfaedle/issues/7 is implemented, we should rely on {shapes,stop_times}.shape_dist_traveled. --- lib/build-trajectory.js | 103 ++- test/build-trajectory.js | 1460 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 1544 insertions(+), 19 deletions(-) diff --git a/lib/build-trajectory.js b/lib/build-trajectory.js index e6fbd6c..d472938 100644 --- a/lib/build-trajectory.js +++ b/lib/build-trajectory.js @@ -11,7 +11,9 @@ const {default: linesIntersection} = require('@turf/line-intersect') // returns [distToSegment, nearestPoint] const nearestOnSegment = (pt, segPtA, segPtB) => { const distToA = distance({type: 'Point', coordinates: segPtA}, pt) + if (distToA === 0) return [segPtA, distToA] const distToB = distance({type: 'Point', coordinates: segPtB}, pt) + if (distToB === 0) return [segPtB, distToB] const perpLength = Math.max(distToA, distToB) const dir = bearing(segPtA, segPtB) @@ -60,6 +62,7 @@ const addInterpolatedTimes = (shapePt, fromI, toI) => { } } +// todo: use shape_dist_traveled if available const buildTrajectory = async (shapeId, shapePoints, schedule, allStopLocs) => { // We violate the GeoJSON spec by a certain extent here: // > A position is an array of numbers. There MUST be two or more @@ -92,6 +95,51 @@ const buildTrajectory = async (shapeId, shapePoints, schedule, allStopLocs) => { const arrivals = Array.from(schedule.arrivals) const departures = Array.from(schedule.departures) const stopLocs = await Promise.all(schedule.stops.map(id => allStopLocs.get(id))) + const insertedShapePts = new Set() + + // handle 1st stop if before 1st segment + const [firstNearest, firstDistance] = nearestOnSegment(stopLocs[0], shapePts[0], shapePts[1]) + if (firstNearest === shapePts[0] && firstDistance > 0) { + // 1st stop is neither closer to 2nd shape pt nor to perpendicular into 1st segment + stopIds.shift() + const arrival = arrivals.shift() + const departure = departures.shift() + const stopLoc = stopLocs.shift() + const newShapePt = [ + stopLoc[0], // longitude + stopLoc[1], // latitude + null, // altitude + arrival, + departure, + ] + debug('adding helper shape segment', newShapePt, 'at 0') + shapePts.unshift(newShapePt) + insertedShapePts.add(newShapePt) + } + + // handle last stop if after last segment + const [lastNearest, lastDistance] = nearestOnSegment( + stopLocs[stopLocs.length - 1], + shapePts[shapePts.length - 2], + shapePts[shapePts.length - 1], + ) + if (lastNearest === shapePts[shapePts.length - 1] && lastDistance > 0) { + // last stop is neither closer to 2nd-last shape pt nor to perpendicular into last segment + stopIds.pop() + const arrival = arrivals.pop() + const departure = departures.pop() + const stopLoc = stopLocs.pop() + const newShapePt = [ + stopLoc[0], // longitude + stopLoc[1], // latitude + null, // altitude + arrival, + departure, + ] + debug('adding helper shape segment', newShapePt, 'at', shapePts.length) + shapePts.push(newShapePt) + insertedShapePts.add(newShapePt) + } // iterate over shape segments, identify nearby stops, add arrival/departure times let stopsI = 0 @@ -104,16 +152,32 @@ const buildTrajectory = async (shapeId, shapePoints, schedule, allStopLocs) => { const [ nearest, distance, ] = nearestOnSegment(stopLoc, fromShapePt, toShapePt) + const iNearest = nearest === fromShapePt + ? i - 1 + : (nearest === toShapePt ? i : NaN) debug({ - stopsI, stopId: stopIds[stopsI], stopLoc, - i, fromShapePt: shapePts[i - 1], toShapePt: shapePts[i], - nearest: nearest === fromShapePt ? 'fromShapePt' : (nearest === toShapePt ? 'toShapePt' : 'intersection'), + stopsI, maxStopsI: stopIds.length - 1, + stopId: stopIds[stopsI], stopLoc, + i, maxI: shapePts.length, + fromShapePt: shapePts[i - 1], toShapePt: shapePts[i], + iNearest, nearest, distance, prevDistance, prevPrevDistance, iPrevNearest, prevNearest, }) - // Has the shape just approached the stop? - if ( + if (distance === 0 && !Number.isNaN(iNearest)) { + const shapePt = shapePts[iNearest] + debug('adding times to shape pt', shapePt, 'at', iNearest) + shapePt[3] = arrivals[stopsI] + shapePt[4] = departures[stopsI] + + stopsI++ + i-- // nearest was 1 iter. ago, repeat loop with *current* segment + prevPrevDistance = prevDistance = Infinity + prevNearest = null + iPrevNearest = NaN + } else if ( + // Has the shape come closest to the stop during the last segment? prevDistance < prevPrevDistance && distance >= prevDistance && prevDistance < .3 // 300m @@ -132,32 +196,26 @@ const buildTrajectory = async (shapeId, shapePoints, schedule, allStopLocs) => { ] debug('adding perpendicular as shape pt', newShapePt, 'at', iPrevNearest) shapePts.splice(iPrevNearest, 0, newShapePt) + insertedShapePts.add(newShapePt) i++ } else { // previous nearest was a shape point - debug('adding times to shape pt', shapePts[iPrevNearest], 'at', iPrevNearest) - shapePts[iPrevNearest][3] = arrivals[stopsI] - shapePts[iPrevNearest][4] = departures[stopsI] + const shapePt = shapePts[iPrevNearest] + debug('adding times to shape pt', shapePt, 'at', iPrevNearest) + shapePt[3] = arrivals[stopsI] + shapePt[4] = departures[stopsI] } + stopsI++ i-- // nearest was 1 iter. ago, repeat loop with *current* segment prevPrevDistance = prevDistance = Infinity prevNearest = null iPrevNearest = NaN - stopsI++ } else { prevPrevDistance = prevDistance prevDistance = distance - if (nearest === fromShapePt) { - prevNearest = fromShapePt - iPrevNearest = i - 1 - } else if (nearest === toShapePt) { - prevNearest = toShapePt - iPrevNearest = i - } else { // nearest is perpendicular into segment - prevNearest = nearest - iPrevNearest = NaN - } + iPrevNearest = iNearest + prevNearest = nearest } } @@ -178,6 +236,13 @@ const buildTrajectory = async (shapeId, shapePoints, schedule, allStopLocs) => { } } + for (let i = 0, l = shapePts.length; i < l; i++) { + if (insertedShapePts.has(shapePts[i])) { + shapePts.splice(i, 1) // remove it + i-- + } + } + return { type: 'Feature', properties: { diff --git a/test/build-trajectory.js b/test/build-trajectory.js index a3e9dd0..be1debd 100644 --- a/test/build-trajectory.js +++ b/test/build-trajectory.js @@ -372,3 +372,1463 @@ test('buildTrajectory works with shape `31-779-j21-2.1.H` & schedule `ZVU8cE` fr [8.8647783, 48.5943038, null, 599, 599], ]) }) + +test('buildTrajectory works with shape `11-16-j21-2.52.R` & schedule `yYcf1` from VVS feed', async (t) => { + const stopLocs = inMemoryStore() + stopLocs.raw.set('de:08425:2551:3:3', [9.873295, 48.577827]) + stopLocs.raw.set('de:08425:2460:3:2', [9.976767, 48.48134]) + stopLocs.raw.set('de:08117:155:20:1', [9.704689, 48.69659]) + stopLocs.raw.set('de:08117:161:21:3', [9.841878, 48.619247]) + stopLocs.raw.set('de:08117:160:20:1', [9.821774, 48.630714]) + stopLocs.raw.set('de:08117:158:20:1', [9.788013, 48.66077]) + stopLocs.raw.set('de:08117:154:20:1', [9.652165, 48.700245]) + stopLocs.raw.set('de:08117:159:20:1', [9.803625, 48.64034]) + stopLocs.raw.set('de:08425:2510:2:1', [9.917342, 48.544975]) + stopLocs.raw.set('de:08117:156:21:2', [9.73705, 48.68938]) + stopLocs.raw.set('de:08117:157:21:2', [9.759716, 48.68374]) + stopLocs.raw.set('de:08421:1008:32:3', [9.982932, 48.399277]) + stopLocs.raw.set('de:08425:2540:1:1', [9.894758, 48.54998]) + stopLocs.raw.set('de:08425:2470:2:2', [9.949404, 48.519833]) + + const shapeId = '11-16-j21-2.52.R' + const shapePoints = [ + [9.652152, 48.700245, 1, 0], + [9.654804, 48.699455, 2, 213.49], + [9.655821, 48.69928, 3, 290.65], + [9.65639, 48.699142, 4, 335.14], + [9.657394, 48.699062, 5, 409.33], + [9.658807, 48.69908, 6, 513.05], + [9.659746, 48.69921, 7, 583.44], + [9.66085, 48.699486, 8, 669.96], + [9.661819, 48.69982, 9, 750.3], + [9.663185, 48.700405, 10, 869.86], + [9.664331, 48.700787, 11, 963.98], + [9.665054, 48.70097, 12, 1020.85], + [9.666865, 48.70131, 13, 1159.02], + [9.668606, 48.701427, 14, 1287.44], + [9.66976, 48.701427, 15, 1372.13], + [9.670575, 48.70137, 16, 1432.3], + [9.693498, 48.698742, 17, 3139.76], + [9.695342, 48.69847, 18, 3278.43], + [9.698391, 48.697903, 19, 3510.92], + [9.704689, 48.696598, 20, 3995.42], + [9.704694, 48.69659, 21, 3995.42], + [9.709678, 48.695457, 22, 4382.26], + [9.727793, 48.691612, 23, 5778.85], + [9.7370405, 48.689384, 24, 6501.49], + [9.7370405, 48.689384, 25, 6501.49], + [9.758222, 48.684185, 26, 8160.44], + [9.759707, 48.68373, 27, 8280.52], + [9.759707, 48.68373, 28, 8280.52], + [9.760837, 48.683296, 29, 8376.55], + [9.761615, 48.682945, 30, 8445.75], + [9.762107, 48.68269, 31, 8491.77], + [9.762889, 48.682224, 32, 8569.06], + [9.763425, 48.68186, 33, 8625.16], + [9.772136, 48.675232, 34, 9601.2], + [9.781043, 48.668358, 35, 10607.23], + [9.782118, 48.6674, 36, 10739.81], + [9.782695, 48.666798, 37, 10819.14], + [9.78801, 48.66077, 38, 11594.65], + [9.78801, 48.66077, 39, 11594.65], + [9.790031, 48.658466, 40, 11890.63], + [9.791389, 48.656742, 41, 12107.03], + [9.799609, 48.645306, 42, 13514.56], + [9.80114, 48.643135, 43, 13781.1], + [9.802377, 48.641468, 44, 13987.38], + [9.803128, 48.640736, 45, 14085.82], + [9.803609, 48.64035, 46, 14141.17], + [9.803609, 48.64035, 47, 14141.17], + [9.804003, 48.64003, 48, 14187.1], + [9.804924, 48.639385, 49, 14285.74], + [9.805417, 48.639095, 50, 14334.28], + [9.806362, 48.638638, 51, 14420.46], + [9.807559, 48.638138, 52, 14524.41], + [9.809795, 48.637386, 53, 14708.74], + [9.810881, 48.636944, 54, 14802.53], + [9.814856, 48.635098, 55, 15159.58], + [9.815983, 48.63452, 56, 15264.32], + [9.817036, 48.633923, 57, 15366.18], + [9.817857, 48.633392, 58, 15450.61], + [9.821248, 48.631046, 59, 15811.52], + [9.8217745, 48.630714, 60, 15864.85], + [9.8217745, 48.630714, 61, 15864.85], + [9.822364, 48.630424, 62, 15918.96], + [9.823965, 48.62982, 63, 16054.2], + [9.82467, 48.629627, 64, 16110.39], + [9.825469, 48.62946, 65, 16172.04], + [9.832053, 48.628536, 66, 16666.67], + [9.833895, 48.62839, 67, 16803], + [9.834692, 48.628395, 68, 16861.55], + [9.835675, 48.62849, 69, 16934.66], + [9.836833, 48.628723, 70, 17023.62], + [9.837443, 48.62889, 71, 17072.15], + [9.837997, 48.629086, 72, 17118.22], + [9.838504, 48.629322, 73, 17163.76], + [9.840591, 48.63049, 74, 17364.66], + [9.841389, 48.6308, 75, 17432.73], + [9.842033, 48.630947, 76, 17482.9], + [9.843039, 48.631046, 77, 17557.53], + [9.843488, 48.631046, 78, 17590.58], + [9.843907, 48.631023, 79, 17621.54], + [9.844565, 48.630924, 80, 17671.1], + [9.845152, 48.63079, 81, 17716.64], + [9.845789, 48.630577, 82, 17769.24], + [9.846463, 48.630226, 83, 17832.36], + [9.84671, 48.630054, 84, 17858.47], + [9.847247, 48.62954, 85, 17928.2], + [9.847474, 48.62925, 86, 17964.52], + [9.847727, 48.628765, 87, 18021.44], + [9.847872, 48.62819, 88, 18086.41], + [9.847867, 48.62781, 89, 18128.3], + [9.847695, 48.627186, 90, 18199.18], + [9.846603, 48.624626, 91, 18494.62], + [9.846271, 48.623917, 92, 18577.51], + [9.846093, 48.62362, 93, 18612.85], + [9.845506, 48.62294, 94, 18699.77], + [9.84527, 48.62272, 95, 18730.07], + [9.844801, 48.622387, 96, 18780.6], + [9.843577, 48.62174, 97, 18895.82], + [9.842846, 48.62123, 98, 18973.89], + [9.842495, 48.620937, 99, 19015.35], + [9.842198, 48.62052, 100, 19066.37], + [9.841988, 48.620056, 101, 19120.58], + [9.841889, 48.61953, 102, 19179.61], + [9.841888, 48.619247, 103, 19210.8], + [9.841888, 48.619247, 104, 19210.8], + [9.841949, 48.618866, 105, 19253.58], + [9.84205, 48.61851, 106, 19293.69], + [9.842367, 48.617767, 107, 19379.53], + [9.842713, 48.6172, 108, 19447.74], + [9.843173, 48.616573, 109, 19524.95], + [9.844981, 48.61435, 110, 19805.83], + [9.845165, 48.614067, 111, 19839.86], + [9.845468, 48.61356, 112, 19900.6], + [9.8455715, 48.613285, 113, 19932.25], + [9.845633, 48.61278, 114, 19988.45], + [9.845585, 48.61234, 115, 20037.44], + [9.845477, 48.612057, 116, 20069.98], + [9.844785, 48.610874, 117, 20211.09], + [9.844646, 48.61061, 118, 20242.08], + [9.8445425, 48.61031, 119, 20276.3], + [9.844473, 48.609818, 120, 20331.27], + [9.8444, 48.608555, 121, 20471.62], + [9.844029, 48.606773, 122, 20671.54], + [9.843974, 48.604996, 123, 20869.64], + [9.843876, 48.604446, 124, 20930.82], + [9.843627, 48.603863, 125, 20998.39], + [9.842783, 48.60239, 126, 21173.33], + [9.842583, 48.602013, 127, 21217.94], + [9.842499, 48.601772, 128, 21245.22], + [9.842441, 48.601368, 129, 21290.75], + [9.842446, 48.601128, 130, 21317.5], + [9.842586, 48.60062, 131, 21374.51], + [9.842873, 48.600117, 132, 21434.63], + [9.843068, 48.59989, 133, 21463.26], + [9.843665, 48.599438, 134, 21530.16], + [9.844416, 48.599075, 135, 21598.57], + [9.844863, 48.598927, 136, 21635.41], + [9.84579, 48.598766, 137, 21705.82], + [9.847786, 48.598545, 138, 21854.73], + [9.848639, 48.598392, 139, 21919.57], + [9.849321, 48.5982, 140, 21974.09], + [9.850297, 48.597824, 141, 22057.27], + [9.85065, 48.59764, 142, 22090.24], + [9.851246, 48.597263, 143, 22150.85], + [9.851868, 48.596786, 144, 22220.98], + [9.852677, 48.59601, 145, 22326.11], + [9.8535795, 48.59495, 146, 22461.07], + [9.853849, 48.59468, 147, 22497.12], + [9.854275, 48.59434, 148, 22545.97], + [9.854804, 48.59404, 149, 22597.36], + [9.855147, 48.593903, 150, 22626.92], + [9.856709, 48.593422, 151, 22753.46], + [9.857222, 48.5932, 152, 22798.69], + [9.8575115, 48.593025, 153, 22827.45], + [9.857981, 48.592663, 154, 22880.41], + [9.858217, 48.592426, 155, 22912.06], + [9.858715, 48.591763, 156, 22994.6], + [9.858908, 48.59156, 157, 23020.92], + [9.859715, 48.59099, 158, 23108.03], + [9.860321, 48.590702, 159, 23162.81], + [9.862882, 48.589836, 160, 23374.28], + [9.8644085, 48.589222, 161, 23505.73], + [9.864782, 48.589058, 162, 23538.84], + [9.865459, 48.588646, 163, 23606.28], + [9.866059, 48.588116, 164, 23680.14], + [9.866771, 48.587204, 165, 23794.18], + [9.867704, 48.585785, 166, 23966.09], + [9.871284, 48.58056, 167, 24604.23], + [9.872414, 48.57894, 168, 24802.48], + [9.873302, 48.577827, 169, 24942.2], + [9.873295, 48.577827, 170, 24942.2], + [9.874704, 48.576206, 171, 25150.04], + [9.875486, 48.575203, 172, 25275.63], + [9.87642, 48.57356, 173, 25470.92], + [9.876733, 48.572872, 174, 25550.6], + [9.877041, 48.57188, 175, 25663.1], + [9.877567, 48.569393, 176, 25942.23], + [9.878025, 48.568455, 177, 26051.94], + [9.878236, 48.56811, 178, 26093.12], + [9.878542, 48.56777, 179, 26137.51], + [9.878875, 48.56746, 180, 26179.71], + [9.879812, 48.56676, 181, 26283.61], + [9.880402, 48.566406, 182, 26342.36], + [9.88102, 48.56612, 183, 26397.66], + [9.88172, 48.565857, 184, 26457.06], + [9.882313, 48.565662, 185, 26505.73], + [9.883014, 48.565495, 186, 26560.56], + [9.887294, 48.56459, 187, 26891.19], + [9.887914, 48.564404, 188, 26941.24], + [9.888465, 48.564194, 189, 26988.08], + [9.889057, 48.56392, 190, 27041.24], + [9.890022, 48.563328, 191, 27138.07], + [9.890661, 48.56271, 192, 27221.25], + [9.89094, 48.562386, 193, 27262.91], + [9.891336, 48.56178, 194, 27336.22], + [9.891518, 48.561348, 195, 27386.2], + [9.89162, 48.560993, 196, 27426.05], + [9.891703, 48.56031, 197, 27502.35], + [9.891607, 48.559486, 198, 27594.47], + [9.891479, 48.559116, 199, 27636.46], + [9.891311, 48.558792, 200, 27674.44], + [9.89017, 48.557087, 201, 27882.1], + [9.889945, 48.556637, 202, 27934.6], + [9.889733, 48.556118, 203, 27994.49], + [9.889641, 48.555527, 204, 28060.77], + [9.889605, 48.55503, 205, 28115.77], + [9.889626, 48.554672, 206, 28155.83], + [9.889699, 48.554222, 207, 28206.15], + [9.889931, 48.553535, 208, 28284.32], + [9.890392, 48.552757, 209, 28377.14], + [9.890763, 48.552334, 210, 28431.72], + [9.891391, 48.55179, 211, 28507.94], + [9.89265, 48.551006, 212, 28635.09], + [9.894745, 48.54998, 213, 28826.71], + [9.894722, 48.549995, 214, 28826.71], + [9.897675, 48.54861, 215, 29093.08], + [9.898239, 48.54841, 216, 29140.23], + [9.899261, 48.548138, 217, 29221.36], + [9.89993, 48.54801, 218, 29272.52], + [9.900568, 48.54794, 219, 29320.13], + [9.9020195, 48.547855, 220, 29427.38], + [9.902909, 48.54788, 221, 29492.92], + [9.9039135, 48.547993, 222, 29567.9], + [9.907638, 48.548553, 223, 29849.09], + [9.908585, 48.548607, 224, 29919.02], + [9.909755, 48.548588, 225, 30005.2], + [9.9102125, 48.54855, 226, 30039.16], + [9.911492, 48.54836, 227, 30135.76], + [9.911982, 48.54825, 228, 30173.78], + [9.912993, 48.547943, 229, 30255.71], + [9.914078, 48.54749, 230, 30350.11], + [9.914553, 48.547226, 231, 30395.51], + [9.915002, 48.54695, 232, 30440.72], + [9.915371, 48.546665, 233, 30482.53], + [9.917326, 48.544994, 234, 30717.4], + [9.917326, 48.544994, 235, 30717.4], + [9.91908, 48.543457, 236, 30931.59], + [9.919677, 48.542866, 237, 31010.65], + [9.9206505, 48.541725, 238, 31156.35], + [9.92121, 48.540943, 239, 31252.78], + [9.921709, 48.54011, 240, 31352.32], + [9.922271, 48.538902, 241, 31493.04], + [9.92367, 48.535194, 242, 31917.99], + [9.924095, 48.534443, 243, 32006.97], + [9.9244585, 48.533978, 244, 32065.17], + [9.9249, 48.533554, 245, 32122.58], + [9.925408, 48.533154, 246, 32180.57], + [9.9263525, 48.53257, 247, 32275.68], + [9.938187, 48.52741, 248, 33319.22], + [9.941524, 48.525814, 249, 33622.09], + [9.94422, 48.52458, 250, 33863.72], + [9.945025, 48.52411, 251, 33942.67], + [9.945749, 48.523636, 252, 34017.45], + [9.947844, 48.521896, 253, 34264.87], + [9.948261, 48.521473, 254, 34321.27], + [9.948622, 48.52105, 255, 34375.26], + [9.949395, 48.51986, 256, 34519.55], + [9.949395, 48.51986, 257, 34519.55], + [9.9498625, 48.518997, 258, 34621.36], + [9.950074, 48.518394, 259, 34690.14], + [9.950363, 48.517235, 260, 34820.85], + [9.950439, 48.51667, 261, 34883.77], + [9.950484, 48.516075, 262, 34950.05], + [9.950481, 48.514187, 263, 35160.11], + [9.950301, 48.51216, 264, 35385.55], + [9.949995, 48.507015, 265, 35958.37], + [9.950042, 48.506386, 266, 36028.44], + [9.950195, 48.50573, 267, 36102.04], + [9.950349, 48.50537, 268, 36143.65], + [9.950738, 48.504726, 269, 36220.76], + [9.951203, 48.504135, 270, 36295.07], + [9.951442, 48.503906, 271, 36326.04], + [9.952161, 48.50336, 272, 36406.44], + [9.952601, 48.50311, 273, 36449.39], + [9.957093, 48.500782, 274, 36869.29], + [9.96638, 48.496128, 275, 37727.25], + [9.9675045, 48.495686, 276, 37823.63], + [9.968728, 48.49532, 277, 37922.56], + [9.972316, 48.49459, 278, 38199.04], + [9.973238, 48.494316, 279, 38273.6], + [9.9740925, 48.493958, 280, 38348.17], + [9.974933, 48.49352, 281, 38427.04], + [9.975609, 48.493042, 282, 38499.7], + [9.975881, 48.492805, 283, 38532.74], + [9.976443, 48.492214, 284, 38610.55], + [9.97676, 48.4918, 285, 38662.06], + [9.976947, 48.49149, 286, 38699.12], + [9.977197, 48.490868, 287, 38770.84], + [9.977353, 48.490124, 288, 38854.21], + [9.977374, 48.489735, 289, 38897.67], + [9.977336, 48.489082, 290, 38970.16], + [9.977028, 48.485302, 291, 39391.08], + [9.97678, 48.481342, 292, 39832.07], + [9.97678, 48.481342, 293, 39832.07], + [9.975266, 48.45941, 294, 42272.95], + [9.975235, 48.458557, 295, 42368.15], + [9.975347, 48.457672, 296, 42466.94], + [9.975505, 48.457127, 297, 42528.48], + [9.97566, 48.45673, 298, 42574.05], + [9.976079, 48.45588, 299, 42673.54], + [9.976582, 48.455166, 300, 42761.08], + [9.976846, 48.454857, 301, 42800.55], + [9.977405, 48.4543, 302, 42875.15], + [9.9780245, 48.45378, 303, 42948.87], + [9.978484, 48.453434, 304, 43000.01], + [9.979547, 48.452778, 305, 43107.07], + [9.980126, 48.452484, 306, 43160.91], + [9.981229, 48.452023, 307, 43257.09], + [9.982564, 48.4516, 308, 43366.19], + [9.983235, 48.451435, 309, 43418.97], + [9.984474, 48.45121, 310, 43513.68], + [9.985596, 48.451084, 311, 43597.53], + [9.99456, 48.450523, 312, 44261.64], + [9.995968, 48.450367, 313, 44366.94], + [9.997399, 48.450123, 314, 44475.87], + [9.999547, 48.449627, 315, 44643.67], + [10.001879, 48.448837, 316, 44836.76], + [10.003179, 48.44828, 317, 44950.9], + [10.008791, 48.445667, 318, 45456.51], + [10.009842, 48.44513, 319, 45554.4], + [10.0102215, 48.44489, 320, 45593.27], + [10.010632, 48.44458, 321, 45638.89], + [10.011215, 48.44403, 322, 45713.56], + [10.011436, 48.443783, 323, 45745.86], + [10.011794, 48.443287, 324, 45806.69], + [10.01202, 48.442894, 325, 45853.6], + [10.012195, 48.44246, 326, 45903.6], + [10.012305, 48.442078, 327, 45946.7], + [10.012375, 48.441666, 328, 45993], + [10.012353, 48.44083, 329, 46085.77], + [10.012276, 48.440445, 330, 46129.25], + [10.012164, 48.4401, 331, 46168.31], + [10.011831, 48.439407, 332, 46249.35], + [10.011579, 48.439014, 333, 46296.47], + [10.011246, 48.43862, 334, 46346.86], + [10.006305, 48.433735, 335, 47001.01], + [10.003376, 48.430912, 336, 47382.07], + [10.0007105, 48.428288, 337, 47734.1], + [10.000165, 48.427795, 338, 47802], + [9.999731, 48.427464, 339, 47850.88], + [9.9986925, 48.4268, 340, 47957.31], + [9.997458, 48.426205, 341, 48069.93], + [9.995261, 48.425327, 342, 48259], + [9.994696, 48.42505, 343, 48310.97], + [9.993958, 48.424606, 344, 48384.46], + [9.993669, 48.424393, 345, 48416.26], + [9.99319, 48.423954, 346, 48476.71], + [9.992758, 48.423473, 347, 48538.88], + [9.992575, 48.423218, 348, 48570.27], + [9.99222, 48.422585, 349, 48645.3], + [9.992062, 48.42218, 350, 48691.85], + [9.991832, 48.42108, 351, 48815.4], + [9.991906, 48.42007, 352, 48927.57], + [9.991993, 48.41948, 353, 48993.59], + [9.992083, 48.419098, 354, 49036.81], + [9.992377, 48.418316, 355, 49126.24], + [9.992623, 48.41788, 356, 49178.06], + [9.992885, 48.417538, 357, 49220.85], + [9.993562, 48.416843, 358, 49312.65], + [9.994334, 48.416214, 359, 49402.94], + [9.994943, 48.415672, 360, 49478.26], + [9.995559, 48.414997, 361, 49565.86], + [9.995814, 48.414646, 362, 49609.28], + [9.996149, 48.414013, 363, 49683.92], + [9.996284, 48.413685, 364, 49721.6], + [9.996386, 48.41333, 365, 49761.68], + [9.996471, 48.412575, 366, 49846.22], + [9.996469, 48.41227, 367, 49880.04], + [9.996427, 48.411945, 368, 49915.97], + [9.996243, 48.411343, 369, 49984.45], + [9.995841, 48.410526, 370, 50079.87], + [9.995218, 48.40976, 371, 50176.94], + [9.99491, 48.409485, 372, 50215], + [9.994324, 48.409042, 373, 50280.63], + [9.993966, 48.408806, 374, 50317.77], + [9.993248, 48.408432, 375, 50385.19], + [9.99252, 48.408142, 376, 50447.71], + [9.9915695, 48.407864, 377, 50524.42], + [9.988042, 48.407066, 378, 50799.56], + [9.987142, 48.40678, 379, 50873.11], + [9.9854555, 48.40601, 380, 51024.35], + [9.984551, 48.405415, 381, 51118.33], + [9.984128, 48.405083, 382, 51166.76], + [9.983853, 48.40482, 383, 51202.15], + [9.983457, 48.40436, 384, 51261.05], + [9.983289, 48.404007, 385, 51302.41], + [9.98325, 48.403316, 386, 51378.96], + [9.983185, 48.402893, 387, 51426.33], + [9.982919, 48.40184, 388, 51545.27], + [9.982861, 48.40148, 389, 51585.14], + [9.982831, 48.400723, 390, 51669.59], + [9.982943, 48.39928, 391, 51830.27], + ].map(([shape_pt_lon, shape_pt_lat, shape_pt_sequence]) => ({ + shape_pt_lat, + shape_pt_lon, + shape_pt_sequence, + shape_dist_traveled: null, + })) + + const schedule = { + id: 'yYcf1', + trips: [ + {tripId: '1.T0.11-16-j21-1.52.R', start: 16260}, + {tripId: '1.T0.11-16-j21-17.48.R', start: 16260}, + {tripId: '1.T0.11-16-j21-2.52.R', start: 16260}, + {tripId: '1.T0.11-16-j21-22.48.R', start: 16260}, + {tripId: '1.T0.11-16-j21-23.52.R', start: 16260}, + ], + stops: [ + 'de:08117:154:20:1', + 'de:08117:155:20:1', + 'de:08117:156:21:2', + 'de:08117:157:21:2', + 'de:08117:158:20:1', + 'de:08117:159:20:1', + 'de:08117:160:20:1', + 'de:08117:161:21:3', + 'de:08425:2551:3:3', + 'de:08425:2540:1:1', + 'de:08425:2510:2:1', + 'de:08425:2470:2:2', + 'de:08425:2460:3:2', + 'de:08421:1008:32:3', + ], + arrivals: [ + 0, 180, 360, 540, + 720, 900, 1020, 1320, + 2280, 2520, 2700, 2880, + 3180, 3840, + ], + departures: [ + 0, 240, 420, 540, + 720, 900, 1080, 1920, + 2340, 2580, 2700, 2880, + 3180, 3840, + ], + headwayBasedStarts: [], + headwayBasedEnds: [], + headwayBasedHeadways: [], + } + + const trajectory = await buildTrajectory(shapeId, shapePoints, schedule, stopLocs) + // printTrajectorForDebugging(trajectory, stopLocs) + + t.deepEqual(trajectory.properties, { + shapeId, + scheduleId: 'yYcf1', + }) + const coords = trajectory.geometry.coordinates.map(([lon, lat, ...r]) => [ + parseFloat(lon.toFixed(7)), + parseFloat(lat.toFixed(7)), + ...r, + ]) + t.deepEqual(coords, [ + [9.652152, 48.700245, null, -0 , -0], + [9.654804, 48.699455, null, 10, 10], + [9.655821, 48.69928, null, 13, 13], + [9.65639, 48.699142, null, 15, 15], + [9.657394, 48.699062, null, 18, 18], + [9.658807, 48.69908, null, 23, 23], + [9.659746, 48.69921, null, 26, 26], + [9.66085, 48.699486, null, 30, 30], + [9.661819, 48.69982, null, 34, 34], + [9.663185, 48.700405, null, 39, 39], + [9.664331, 48.700787, null, 43, 43], + [9.665054, 48.70097, null, 46, 46], + [9.666865, 48.70131, null, 52, 52], + [9.668606, 48.701427, null, 58, 58], + [9.66976, 48.701427, null, 62, 62], + [9.670575, 48.70137, null, 64, 64], + [9.693498, 48.698742, null, 141, 141], + [9.695342, 48.69847, null, 148, 148], + [9.698391, 48.697903, null, 158, 158], + [9.704689, 48.696598, null, 180, 180], + [9.704694, 48.69659, null, 240, 240], + [9.709678, 48.695457, null, 259, 259], + [9.727793, 48.691612, null, 325, 325], + [9.7370405, 48.689384, null, 360, 420], + [9.7370405, 48.689384, null, 420, 420], + [9.758222, 48.684185, null, 532, 532], + [9.759707, 48.68373, null, 540, 540], + [9.759707, 48.68373, null, 540, 540], + [9.760837, 48.683296, null, 545, 545], + [9.761615, 48.682945, null, 549, 549], + [9.762107, 48.68269, null, 551, 551], + [9.762889, 48.682224, null, 556, 556], + [9.763425, 48.68186, null, 559, 559], + [9.772136, 48.675232, null, 612, 612], + [9.781043, 48.668358, null, 666, 666], + [9.782118, 48.6674, null, 674, 674], + [9.782695, 48.666798, null, 678, 678], + [9.78801, 48.66077, null, 720, 720], + [9.78801, 48.66077, null, 720, 720], + [9.790031, 48.658466, null, 741, 741], + [9.791389, 48.656742, null, 756, 756], + [9.799609, 48.645306, null, 856, 856], + [9.80114, 48.643135, null, 875, 875], + [9.802377, 48.641468, null, 889, 889], + [9.803128, 48.640736, null, 896, 896], + [9.803609, 48.64035, null, 900, 900], + [9.803609, 48.64035, null, 900, 900], + [9.804003, 48.64003, null, 903, 903], + [9.804924, 48.639385, null, 910, 910], + [9.805417, 48.639095, null, 913, 913], + [9.806362, 48.638638, null, 919, 919], + [9.807559, 48.638138, null, 927, 927], + [9.809795, 48.637386, null, 940, 940], + [9.810881, 48.636944, null, 946, 946], + [9.814856, 48.635098, null, 971, 971], + [9.815983, 48.63452, null, 978, 978], + [9.817036, 48.633923, null, 985, 985], + [9.817857, 48.633392, null, 991, 991], + [9.821248, 48.631046, null, 1016, 1016], + [9.8217745, 48.630714, null, 1080, 1080], + [9.8217745, 48.630714, null, 1080, 1080], + [9.822364, 48.630424, null, 1084, 1084], + [9.823965, 48.62982, null, 1094, 1094], + [9.82467, 48.629627, null, 1098, 1098], + [9.825469, 48.62946, null, 1102, 1102], + [9.832053, 48.628536, null, 1138, 1138], + [9.833895, 48.62839, null, 1147, 1147], + [9.834692, 48.628395, null, 1151, 1151], + [9.835675, 48.62849, null, 1157, 1157], + [9.836833, 48.628723, null, 1163, 1163], + [9.837443, 48.62889, null, 1167, 1167], + [9.837997, 48.629086, null, 1170, 1170], + [9.838504, 48.629322, null, 1173, 1173], + [9.840591, 48.63049, null, 1188, 1188], + [9.841389, 48.6308, null, 1192, 1192], + [9.842033, 48.630947, null, 1196, 1196], + [9.843039, 48.631046, null, 1201, 1201], + [9.843488, 48.631046, null, 1204, 1204], + [9.843907, 48.631023, null, 1206, 1206], + [9.844565, 48.630924, null, 1210, 1210], + [9.845152, 48.63079, null, 1213, 1213], + [9.845789, 48.630577, null, 1217, 1217], + [9.846463, 48.630226, null, 1221, 1221], + [9.84671, 48.630054, null, 1223, 1223], + [9.847247, 48.62954, null, 1228, 1228], + [9.847474, 48.62925, null, 1231, 1231], + [9.847727, 48.628765, null, 1235, 1235], + [9.847872, 48.62819, null, 1239, 1239], + [9.847867, 48.62781, null, 1242, 1242], + [9.847695, 48.627186, null, 1247, 1247], + [9.846603, 48.624626, null, 1269, 1269], + [9.846271, 48.623917, null, 1275, 1275], + [9.846093, 48.62362, null, 1277, 1277], + [9.845506, 48.62294, null, 1283, 1283], + [9.84527, 48.62272, null, 1286, 1286], + [9.844801, 48.622387, null, 1289, 1289], + [9.843577, 48.62174, null, 1297, 1297], + [9.842846, 48.62123, null, 1303, 1303], + [9.842495, 48.620937, null, 1306, 1306], + [9.842198, 48.62052, null, 1310, 1310], + [9.841988, 48.620056, null, 1314, 1314], + [9.841889, 48.61953, null, 1318, 1318], + [9.841888, 48.619247, null, 1320, 1920], + [9.841888, 48.619247, null, 1920, 1920], + [9.841949, 48.618866, null, 1923, 1923], + [9.84205, 48.61851, null, 1925, 1925], + [9.842367, 48.617767, null, 1931, 1931], + [9.842713, 48.6172, null, 1935, 1935], + [9.843173, 48.616573, null, 1940, 1940], + [9.844981, 48.61435, null, 1957, 1957], + [9.845165, 48.614067, null, 1960, 1960], + [9.845468, 48.61356, null, 1963, 1963], + [9.8455715, 48.613285, null, 1965, 1965], + [9.845633, 48.61278, null, 1969, 1969], + [9.845585, 48.61234, null, 1972, 1972], + [9.845477, 48.612057, null, 1974, 1974], + [9.844785, 48.610874, null, 1983, 1983], + [9.844646, 48.61061, null, 1985, 1985], + [9.8445425, 48.61031, null, 1987, 1987], + [9.844473, 48.609818, null, 1990, 1990], + [9.8444, 48.608555, null, 1999, 1999], + [9.844029, 48.606773, null, 2012, 2012], + [9.843974, 48.604996, null, 2024, 2024], + [9.843876, 48.604446, null, 2028, 2028], + [9.843627, 48.603863, null, 2032, 2032], + [9.842783, 48.60239, null, 2043, 2043], + [9.842583, 48.602013, null, 2046, 2046], + [9.842499, 48.601772, null, 2048, 2048], + [9.842441, 48.601368, null, 2051, 2051], + [9.842446, 48.601128, null, 2052, 2052], + [9.842586, 48.60062, null, 2056, 2056], + [9.842873, 48.600117, null, 2060, 2060], + [9.843068, 48.59989, null, 2061, 2061], + [9.843665, 48.599438, null, 2066, 2066], + [9.844416, 48.599075, null, 2070, 2070], + [9.844863, 48.598927, null, 2072, 2072], + [9.84579, 48.598766, null, 2077, 2077], + [9.847786, 48.598545, null, 2086, 2086], + [9.848639, 48.598392, null, 2090, 2090], + [9.849321, 48.5982, null, 2094, 2094], + [9.850297, 48.597824, null, 2099, 2099], + [9.85065, 48.59764, null, 2101, 2101], + [9.851246, 48.597263, null, 2105, 2105], + [9.851868, 48.596786, null, 2109, 2109], + [9.852677, 48.59601, null, 2116, 2116], + [9.8535795, 48.59495, null, 2124, 2124], + [9.853849, 48.59468, null, 2126, 2126], + [9.854275, 48.59434, null, 2129, 2129], + [9.854804, 48.59404, null, 2133, 2133], + [9.855147, 48.593903, null, 2135, 2135], + [9.856709, 48.593422, null, 2142, 2142], + [9.857222, 48.5932, null, 2145, 2145], + [9.8575115, 48.593025, null, 2147, 2147], + [9.857981, 48.592663, null, 2150, 2150], + [9.858217, 48.592426, null, 2152, 2152], + [9.858715, 48.591763, null, 2158, 2158], + [9.858908, 48.59156, null, 2159, 2159], + [9.859715, 48.59099, null, 2165, 2165], + [9.860321, 48.590702, null, 2168, 2168], + [9.862882, 48.589836, null, 2181, 2181], + [9.8644085, 48.589222, null, 2190, 2190], + [9.864782, 48.589058, null, 2192, 2192], + [9.865459, 48.588646, null, 2196, 2196], + [9.866059, 48.588116, null, 2201, 2201], + [9.866771, 48.587204, null, 2208, 2208], + [9.867704, 48.585785, null, 2219, 2219], + [9.871284, 48.58056, null, 2259, 2259], + [9.872414, 48.57894, null, 2271, 2271], + [9.873302, 48.577827, null, 2280, 2280], + [9.873295, 48.577827, null, 2280, 2340], + [9.874704, 48.576206, null, 2350, 2350], + [9.875486, 48.575203, null, 2355, 2355], + [9.87642, 48.57356, null, 2364, 2364], + [9.876733, 48.572872, null, 2368, 2368], + [9.877041, 48.57188, null, 2373, 2373], + [9.877567, 48.569393, null, 2386, 2386], + [9.878025, 48.568455, null, 2391, 2391], + [9.878236, 48.56811, null, 2393, 2393], + [9.878542, 48.56777, null, 2395, 2395], + [9.878875, 48.56746, null, 2397, 2397], + [9.879812, 48.56676, null, 2402, 2402], + [9.880402, 48.566406, null, 2405, 2405], + [9.88102, 48.56612, null, 2407, 2407], + [9.88172, 48.565857, null, 2410, 2410], + [9.882313, 48.565662, null, 2412, 2412], + [9.883014, 48.565495, null, 2415, 2415], + [9.887294, 48.56459, null, 2430, 2430], + [9.887914, 48.564404, null, 2433, 2433], + [9.888465, 48.564194, null, 2435, 2435], + [9.889057, 48.56392, null, 2437, 2437], + [9.890022, 48.563328, null, 2442, 2442], + [9.890661, 48.56271, null, 2446, 2446], + [9.89094, 48.562386, null, 2448, 2448], + [9.891336, 48.56178, null, 2451, 2451], + [9.891518, 48.561348, null, 2453, 2453], + [9.89162, 48.560993, null, 2455, 2455], + [9.891703, 48.56031, null, 2459, 2459], + [9.891607, 48.559486, null, 2463, 2463], + [9.891479, 48.559116, null, 2465, 2465], + [9.891311, 48.558792, null, 2467, 2467], + [9.89017, 48.557087, null, 2476, 2476], + [9.889945, 48.556637, null, 2479, 2479], + [9.889733, 48.556118, null, 2481, 2481], + [9.889641, 48.555527, null, 2484, 2484], + [9.889605, 48.55503, null, 2487, 2487], + [9.889626, 48.554672, null, 2489, 2489], + [9.889699, 48.554222, null, 2491, 2491], + [9.889931, 48.553535, null, 2495, 2495], + [9.890392, 48.552757, null, 2499, 2499], + [9.890763, 48.552334, null, 2502, 2502], + [9.891391, 48.55179, null, 2505, 2505], + [9.89265, 48.551006, null, 2511, 2511], + [9.894745, 48.54998, null, 2520, 2580], + [9.894722, 48.549995, null, 2580, 2580], + [9.897675, 48.54861, null, 2597, 2597], + [9.898239, 48.54841, null, 2600, 2600], + [9.899261, 48.548138, null, 2605, 2605], + [9.89993, 48.54801, null, 2608, 2608], + [9.900568, 48.54794, null, 2611, 2611], + [9.9020195, 48.547855, null, 2618, 2618], + [9.902909, 48.54788, null, 2622, 2622], + [9.9039135, 48.547993, null, 2627, 2627], + [9.907638, 48.548553, null, 2645, 2645], + [9.908585, 48.548607, null, 2649, 2649], + [9.909755, 48.548588, null, 2655, 2655], + [9.9102125, 48.54855, null, 2657, 2657], + [9.911492, 48.54836, null, 2663, 2663], + [9.911982, 48.54825, null, 2666, 2666], + [9.912993, 48.547943, null, 2671, 2671], + [9.914078, 48.54749, null, 2677, 2677], + [9.914553, 48.547226, null, 2680, 2680], + [9.915002, 48.54695, null, 2682, 2682], + [9.915371, 48.546665, null, 2685, 2685], + [9.917326, 48.544994, null, 2700, 2700], + [9.917326, 48.544994, null, 2700, 2700], + [9.91908, 48.543457, null, 2710, 2710], + [9.919677, 48.542866, null, 2714, 2714], + [9.9206505, 48.541725, null, 2721, 2721], + [9.92121, 48.540943, null, 2725, 2725], + [9.921709, 48.54011, null, 2730, 2730], + [9.922271, 48.538902, null, 2737, 2737], + [9.92367, 48.535194, null, 2757, 2757], + [9.924095, 48.534443, null, 2761, 2761], + [9.9244585, 48.533978, null, 2764, 2764], + [9.9249, 48.533554, null, 2767, 2767], + [9.925408, 48.533154, null, 2769, 2769], + [9.9263525, 48.53257, null, 2774, 2774], + [9.938187, 48.52741, null, 2823, 2823], + [9.941524, 48.525814, null, 2838, 2838], + [9.94422, 48.52458, null, 2849, 2849], + [9.945025, 48.52411, null, 2853, 2853], + [9.945749, 48.523636, null, 2856, 2856], + [9.947844, 48.521896, null, 2868, 2868], + [9.948261, 48.521473, null, 2871, 2871], + [9.948622, 48.52105, null, 2873, 2873], + [9.949395, 48.51986, null, 2880, 2880], + [9.949395, 48.51986, null, 2880, 2880], + [9.9498625, 48.518997, null, 2886, 2886], + [9.950074, 48.518394, null, 2890, 2890], + [9.950363, 48.517235, null, 2897, 2897], + [9.950439, 48.51667, null, 2901, 2901], + [9.950484, 48.516075, null, 2904, 2904], + [9.950481, 48.514187, null, 2916, 2916], + [9.950301, 48.51216, null, 2929, 2929], + [9.949995, 48.507015, null, 2961, 2961], + [9.950042, 48.506386, null, 2965, 2965], + [9.950195, 48.50573, null, 2969, 2969], + [9.950349, 48.50537, null, 2972, 2972], + [9.950738, 48.504726, null, 2976, 2976], + [9.951203, 48.504135, null, 2980, 2980], + [9.951442, 48.503906, null, 2982, 2982], + [9.952161, 48.50336, null, 2987, 2987], + [9.952601, 48.50311, null, 2989, 2989], + [9.957093, 48.500782, null, 3013, 3013], + [9.96638, 48.496128, null, 3061, 3061], + [9.9675045, 48.495686, null, 3067, 3067], + [9.968728, 48.49532, null, 3072, 3072], + [9.972316, 48.49459, null, 3088, 3088], + [9.973238, 48.494316, null, 3092, 3092], + [9.9740925, 48.493958, null, 3096, 3096], + [9.974933, 48.49352, null, 3101, 3101], + [9.975609, 48.493042, null, 3105, 3105], + [9.975881, 48.492805, null, 3107, 3107], + [9.976443, 48.492214, null, 3111, 3111], + [9.97676, 48.4918, null, 3114, 3114], + [9.976947, 48.49149, null, 3116, 3116], + [9.977197, 48.490868, null, 3120, 3120], + [9.977353, 48.490124, null, 3125, 3125], + [9.977374, 48.489735, null, 3127, 3127], + [9.977336, 48.489082, null, 3131, 3131], + [9.977028, 48.485302, null, 3155, 3155], + [9.97678, 48.481342, null, 3180, 3180], + [9.97678, 48.481342, null, 3180, 3180], + [9.975266, 48.45941, null, 3314, 3314], + [9.975235, 48.458557, null, 3319, 3319], + [9.975347, 48.457672, null, 3325, 3325], + [9.975505, 48.457127, null, 3328, 3328], + [9.97566, 48.45673, null, 3331, 3331], + [9.976079, 48.45588, null, 3336, 3336], + [9.976582, 48.455166, null, 3341, 3341], + [9.976846, 48.454857, null, 3343, 3343], + [9.977405, 48.4543, null, 3347, 3347], + [9.9780245, 48.45378, null, 3351, 3351], + [9.978484, 48.453434, null, 3354, 3354], + [9.979547, 48.452778, null, 3360, 3360], + [9.980126, 48.452484, null, 3363, 3363], + [9.981229, 48.452023, null, 3368, 3368], + [9.982564, 48.4516, null, 3374, 3374], + [9.983235, 48.451435, null, 3377, 3377], + [9.984474, 48.45121, null, 3383, 3383], + [9.985596, 48.451084, null, 3387, 3387], + [9.99456, 48.450523, null, 3424, 3424], + [9.995968, 48.450367, null, 3429, 3429], + [9.997399, 48.450123, null, 3435, 3435], + [9.999547, 48.449627, null, 3445, 3445], + [10.001879, 48.448837, null, 3455, 3455], + [10.003179, 48.44828, null, 3462, 3462], + [10.008791, 48.445667, null, 3489, 3489], + [10.009842, 48.44513, null, 3495, 3495], + [10.0102215, 48.44489, null, 3497, 3497], + [10.010632, 48.44458, null, 3499, 3499], + [10.011215, 48.44403, null, 3504, 3504], + [10.011436, 48.443783, null, 3505, 3505], + [10.011794, 48.443287, null, 3509, 3509], + [10.01202, 48.442894, null, 3511, 3511], + [10.012195, 48.44246, null, 3514, 3514], + [10.012305, 48.442078, null, 3516, 3516], + [10.012375, 48.441666, null, 3519, 3519], + [10.012353, 48.44083, null, 3524, 3524], + [10.012276, 48.440445, null, 3526, 3526], + [10.012164, 48.4401, null, 3529, 3529], + [10.011831, 48.439407, null, 3533, 3533], + [10.011579, 48.439014, null, 3536, 3536], + [10.011246, 48.43862, null, 3538, 3538], + [10.006305, 48.433735, null, 3574, 3574], + [10.003376, 48.430912, null, 3595, 3595], + [10.0007105, 48.428288, null, 3615, 3615], + [10.000165, 48.427795, null, 3618, 3618], + [9.999731, 48.427464, null, 3621, 3621], + [9.9986925, 48.4268, null, 3627, 3627], + [9.997458, 48.426205, null, 3633, 3633], + [9.995261, 48.425327, null, 3644, 3644], + [9.994696, 48.42505, null, 3646, 3646], + [9.993958, 48.424606, null, 3650, 3650], + [9.993669, 48.424393, null, 3652, 3652], + [9.99319, 48.423954, null, 3655, 3655], + [9.992758, 48.423473, null, 3659, 3659], + [9.992575, 48.423218, null, 3661, 3661], + [9.99222, 48.422585, null, 3665, 3665], + [9.992062, 48.42218, null, 3667, 3667], + [9.991832, 48.42108, null, 3674, 3674], + [9.991906, 48.42007, null, 3680, 3680], + [9.991993, 48.41948, null, 3684, 3684], + [9.992083, 48.419098, null, 3686, 3686], + [9.992377, 48.418316, null, 3691, 3691], + [9.992623, 48.41788, null, 3694, 3694], + [9.992885, 48.417538, null, 3696, 3696], + [9.993562, 48.416843, null, 3701, 3701], + [9.994334, 48.416214, null, 3706, 3706], + [9.994943, 48.415672, null, 3711, 3711], + [9.995559, 48.414997, null, 3715, 3715], + [9.995814, 48.414646, null, 3718, 3718], + [9.996149, 48.414013, null, 3722, 3722], + [9.996284, 48.413685, null, 3724, 3724], + [9.996386, 48.41333, null, 3726, 3726], + [9.996471, 48.412575, null, 3731, 3731], + [9.996469, 48.41227, null, 3733, 3733], + [9.996427, 48.411945, null, 3735, 3735], + [9.996243, 48.411343, null, 3738, 3738], + [9.995841, 48.410526, null, 3744, 3744], + [9.995218, 48.40976, null, 3749, 3749], + [9.99491, 48.409485, null, 3751, 3751], + [9.994324, 48.409042, null, 3755, 3755], + [9.993966, 48.408806, null, 3757, 3757], + [9.993248, 48.408432, null, 3760, 3760], + [9.99252, 48.408142, null, 3764, 3764], + [9.9915695, 48.407864, null, 3768, 3768], + [9.988042, 48.407066, null, 3783, 3783], + [9.987142, 48.40678, null, 3787, 3787], + [9.9854555, 48.40601, null, 3796, 3796], + [9.984551, 48.405415, null, 3801, 3801], + [9.984128, 48.405083, null, 3803, 3803], + [9.983853, 48.40482, null, 3805, 3805], + [9.983457, 48.40436, null, 3809, 3809], + [9.983289, 48.404007, null, 3811, 3811], + [9.98325, 48.403316, null, 3815, 3815], + [9.983185, 48.402893, null, 3818, 3818], + [9.982919, 48.40184, null, 3824, 3824], + [9.982861, 48.40148, null, 3826, 3826], + [9.982831, 48.400723, null, 3831, 3831], + [9.982943, 48.39928, null, 3840, 3840], + ]) +}) + +// `31-187-j21-5.9.R` has several "lasso" parts. +test('buildTrajectory works with shape `31-187-j21-5.9.R` & schedule `Z1txJMF` from VVS feed', async (t) => { + const stopLocs = inMemoryStore() + stopLocs.raw.set('de:08116:4313:0:4', [9.258469, 48.576164]) + stopLocs.raw.set('de:08116:5772:3:3', [9.272604, 48.57117]) + stopLocs.raw.set('de:08116:4315:0:4', [9.266, 48.572838]) + stopLocs.raw.set('de:08116:4316:1:3', [9.268566, 48.57127]) + stopLocs.raw.set('de:08116:4490:0:4', [9.271339, 48.570362]) + stopLocs.raw.set('de:08116:5900:0:3', [9.308392, 48.593605]) + stopLocs.raw.set('de:08116:5901:0:3', [9.314368, 48.591053]) + stopLocs.raw.set('de:08116:4312:0:3', [9.301286, 48.590855]) + stopLocs.raw.set('de:08116:6846:0:3', [9.31038, 48.590687]) + stopLocs.raw.set('de:08116:6956:0:3', [9.3174, 48.58823]) + stopLocs.raw.set('de:08116:4463:0:3', [9.309814, 48.595642]) + stopLocs.raw.set('de:08116:4464:0:4', [9.284565, 48.57053]) + stopLocs.raw.set('de:08116:4465:0:3', [9.288147, 48.57126]) + stopLocs.raw.set('de:08116:4310:0:5', [9.243938, 48.586845]) + stopLocs.raw.set('de:08116:4311:0:4', [9.253805, 48.578453]) + + const shapeId = '31-187-j21-5.9.R' + const shapePoints = [ + [9.317403, 48.588223, 1, 0], + [9.317306, 48.588215, 2, 7.22], + [9.317215, 48.588135, 3, 18.3], + [9.317332, 48.588062, 4, 30.12], + [9.317419, 48.588055, 5, 36.62], + [9.317668, 48.588116, 6, 56.27], + [9.317728, 48.588165, 7, 63.21], + [9.318756, 48.587875, 8, 145.5], + [9.319731, 48.587845, 9, 217.27], + [9.319697, 48.59, 10, 456.97], + [9.319713, 48.59076, 11, 541.71], + [9.319758, 48.591286, 12, 599.99], + [9.31983, 48.59159, 13, 634.42], + [9.319951, 48.591904, 14, 670.47], + [9.320505, 48.59293, 15, 791.55], + [9.320575, 48.593224, 16, 824.69], + [9.3205805, 48.59359, 17, 865.37], + [9.318464, 48.59288, 18, 1039.82], + [9.316523, 48.592136, 19, 1204.86], + [9.316053, 48.591915, 20, 1247.4], + [9.314853, 48.591248, 21, 1362.81], + [9.31436, 48.59106, 22, 1404.56], + [9.31436, 48.59106, 23, 1404.56], + [9.314013, 48.59097, 24, 1432.05], + [9.313734, 48.59094, 25, 1452.78], + [9.31174, 48.590824, 26, 1600], + [9.310376, 48.590702, 27, 1701.22], + [9.310376, 48.590702, 28, 1701.22], + [9.309253, 48.590584, 29, 1784.85], + [9.308971, 48.590607, 30, 1805.66], + [9.308756, 48.590664, 31, 1822.77], + [9.308814, 48.59076, 32, 1834.39], + [9.308836, 48.590885, 33, 1848.09], + [9.308924, 48.592297, 34, 2005.53], + [9.308896, 48.5924, 35, 2016.98], + [9.308635, 48.59265, 36, 2051.02], + [9.308454, 48.592922, 37, 2083.93], + [9.308369, 48.59321, 38, 2116.3], + [9.308365, 48.5936, 39, 2159.97], + [9.308365, 48.5936, 40, 2159.97], + [9.308491, 48.594112, 41, 2217.71], + [9.308734, 48.594578, 42, 2272.35], + [9.309101, 48.595, 43, 2326.43], + [9.309836, 48.59563, 44, 2414.99], + [9.309836, 48.59563, 45, 2414.99], + [9.310128, 48.59592, 46, 2453.79], + [9.310371, 48.596306, 47, 2500.24], + [9.310445, 48.59659, 48, 2532], + [9.310476, 48.59705, 49, 2583.56], + [9.310537, 48.597153, 50, 2595.74], + [9.31046, 48.597248, 51, 2607.65], + [9.310358, 48.59727, 52, 2615.64], + [9.3102455, 48.59725, 53, 2624.15], + [9.310154, 48.59715, 54, 2637.35], + [9.31003, 48.597095, 55, 2648.27], + [9.309127, 48.596844, 56, 2720.32], + [9.308051, 48.596603, 57, 2803.82], + [9.307133, 48.596447, 58, 2873.59], + [9.305925, 48.596348, 59, 2963.12], + [9.303994, 48.59634, 60, 3105.08], + [9.303229, 48.596275, 61, 3161.8], + [9.302737, 48.596203, 62, 3198.9], + [9.302112, 48.596058, 63, 3247.69], + [9.301599, 48.59589, 64, 3289.77], + [9.300727, 48.595493, 65, 3367.54], + [9.300202, 48.595158, 66, 3421.26], + [9.299765, 48.594788, 67, 3473.49], + [9.299312, 48.59428, 68, 3539.07], + [9.299105, 48.593937, 69, 3579.94], + [9.2989645, 48.59364, 70, 3614.86], + [9.29824, 48.59139, 71, 3870.51], + [9.299016, 48.591255, 72, 3929.48], + [9.301028, 48.591022, 73, 4079.71], + [9.30101, 48.59097, 74, 4085.57], + [9.301289, 48.590855, 75, 4109.87], + [9.301272, 48.590855, 76, 4109.87], + [9.301489, 48.590836, 77, 4125.97], + [9.301529, 48.590855, 78, 4129.53], + [9.301557, 48.590942, 79, 4139.75], + [9.300853, 48.591053, 80, 4192.95], + [9.29901, 48.591255, 81, 4330.35], + [9.298239, 48.591393, 82, 4389.06], + [9.297416, 48.589794, 83, 4576.78], + [9.296624, 48.588905, 84, 4691.52], + [9.295739, 48.5881, 85, 4802.38], + [9.295072, 48.587616, 86, 4875.2], + [9.294351, 48.58717, 87, 4947.88], + [9.293535, 48.586727, 88, 5025.25], + [9.292488, 48.58628, 89, 5116.91], + [9.290832, 48.58582, 90, 5249.15], + [9.289936, 48.585613, 91, 5318.88], + [9.289041, 48.585457, 92, 5387.05], + [9.286613, 48.585163, 93, 5568.55], + [9.283738, 48.58492, 94, 5781.77], + [9.282178, 48.584698, 95, 5899.12], + [9.280509, 48.584297, 96, 6029.7], + [9.27949, 48.58384, 97, 6120.25], + [9.278878, 48.58352, 98, 6177.77], + [9.278416, 48.583233, 99, 6224.32], + [9.277708, 48.582676, 100, 6305.15], + [9.277231, 48.5822, 101, 6368.66], + [9.276835, 48.5817, 102, 6431.62], + [9.276493, 48.581116, 103, 6501.26], + [9.276314, 48.580704, 104, 6549.03], + [9.275775, 48.57867, 105, 6778.33], + [9.275624, 48.57834, 106, 6816.98], + [9.275323, 48.577896, 107, 6870.69], + [9.275051, 48.57761, 108, 6908.35], + [9.274833, 48.57743, 109, 6933.92], + [9.274493, 48.577183, 110, 6971.39], + [9.274058, 48.57693, 111, 7013.86], + [9.273188, 48.576565, 112, 7089.7], + [9.271763, 48.57608, 113, 7207.5], + [9.271233, 48.57582, 114, 7255.97], + [9.270757, 48.57549, 115, 7306.86], + [9.2696, 48.57448, 116, 7448.04], + [9.269191, 48.574047, 117, 7504.63], + [9.26904, 48.573814, 118, 7532.82], + [9.268917, 48.573498, 119, 7569], + [9.268627, 48.5726, 120, 7671.1], + [9.268354, 48.572144, 121, 7725.85], + [9.268163, 48.571934, 122, 7752.82], + [9.268379, 48.57171, 123, 7782.46], + [9.268553, 48.57135, 124, 7824.48], + [9.268579, 48.57118, 125, 7843.59], + [9.268564, 48.570946, 126, 7869.64], + [9.2687, 48.570908, 127, 7880.41], + [9.268767, 48.570854, 128, 7888.18], + [9.26882, 48.570557, 129, 7921.44], + [9.269008, 48.57035, 130, 7948.39], + [9.269373, 48.57017, 131, 7981.88], + [9.269644, 48.570087, 132, 8003.81], + [9.270375, 48.56991, 133, 8061.23], + [9.270727, 48.56987, 134, 8087.46], + [9.271161, 48.569904, 135, 8119.63], + [9.271636, 48.570038, 136, 8157.62], + [9.272043, 48.57027, 137, 8197.15], + [9.272833, 48.5709, 138, 8288], + [9.272914, 48.57086, 139, 8295.18], + [9.27309, 48.570896, 140, 8308.7], + [9.273131, 48.570953, 141, 8315.42], + [9.273077, 48.57104, 142, 8326.19], + [9.2732, 48.571114, 143, 8338.27], + [9.273661, 48.57126, 144, 8375.74], + [9.274422, 48.571598, 145, 8443.3], + [9.274883, 48.571747, 146, 8481.14], + [9.275575, 48.571846, 147, 8533.21], + [9.276374, 48.57178, 148, 8592.44], + [9.277186, 48.571583, 149, 8656.19], + [9.277727, 48.571346, 150, 8703.8], + [9.278713, 48.57076, 151, 8801.39], + [9.279348, 48.570454, 152, 8859.25], + [9.281403, 48.56967, 153, 9033.51], + [9.281728, 48.569584, 154, 9059.43], + [9.281918, 48.569565, 155, 9073.57], + [9.282405, 48.56958, 156, 9109.46], + [9.283111, 48.569805, 157, 9167.02], + [9.283369, 48.569912, 158, 9189.42], + [9.284321, 48.57045, 159, 9281.54], + [9.284756, 48.570656, 160, 9320.83], + [9.285883, 48.571083, 161, 9416.49], + [9.286479, 48.571156, 162, 9461.05], + [9.286764, 48.571136, 163, 9482.13], + [9.287062, 48.57107, 164, 9505.18], + [9.287117, 48.571243, 165, 9524.62], + [9.287065, 48.57161, 166, 9565.83], + [9.287079, 48.57172, 167, 9577.88], + [9.28742, 48.572094, 168, 9626.64], + [9.28842, 48.571724, 169, 9710.99], + [9.288379, 48.571545, 170, 9731.12], + [9.288106, 48.571285, 171, 9766.42], + [9.288119, 48.571274, 172, 9766.42], + [9.287495, 48.57093, 173, 9826.27], + [9.286764, 48.57113, 174, 9884.34], + [9.286372, 48.571148, 175, 9913.23], + [9.28602, 48.571106, 176, 9939.55], + [9.285623, 48.570984, 177, 9971.81], + [9.284536, 48.57055, 178, 10065.32], + [9.284536, 48.57055, 179, 10065.32], + [9.283461, 48.569946, 180, 10168.77], + [9.282974, 48.569744, 181, 10211.24], + [9.282409, 48.56958, 182, 10256.62], + [9.282023, 48.569553, 183, 10285.07], + [9.281741, 48.56958, 184, 10306.05], + [9.281404, 48.56967, 185, 10332.79], + [9.2796755, 48.57032, 186, 10479.16], + [9.279024, 48.5706, 187, 10536.04], + [9.277451, 48.571476, 188, 10687.55], + [9.276917, 48.57166, 189, 10731.79], + [9.276384, 48.571774, 190, 10773.02], + [9.275732, 48.57184, 191, 10821.54], + [9.275158, 48.571796, 192, 10864.09], + [9.274522, 48.571625, 193, 10914.54], + [9.273939, 48.571358, 194, 10966.77], + [9.273284, 48.571136, 195, 11020.87], + [9.273086, 48.57104, 196, 11038.98], + [9.272993, 48.57107, 197, 11046.59], + [9.272891, 48.57106, 198, 11054.2], + [9.2728815, 48.571182, 199, 11067.57], + [9.272611, 48.57117, 200, 11087.51], + [9.272611, 48.57117, 201, 11087.51], + [9.272009, 48.57101, 202, 11135.3], + [9.271187, 48.570858, 203, 11198.05], + [9.2713585, 48.570362, 204, 11254.58], + [9.2713585, 48.570362, 205, 11254.58], + [9.271514, 48.56999, 206, 11297.98], + [9.271037, 48.56988, 207, 11334.96], + [9.270488, 48.569885, 208, 11375.38], + [9.269508, 48.570126, 209, 11452.24], + [9.269108, 48.57029, 210, 11487.01], + [9.268895, 48.570457, 211, 11511.15], + [9.26881, 48.5706, 212, 11527.98], + [9.26877, 48.570847, 213, 11555.8], + [9.268707, 48.5709, 214, 11563.51], + [9.268566, 48.570942, 215, 11574.85], + [9.268574, 48.571274, 216, 11611.65], + [9.268574, 48.571274, 217, 11611.65], + [9.26851, 48.571472, 218, 11634.2], + [9.268386, 48.571705, 219, 11661.84], + [9.268171, 48.571926, 220, 11691.02], + [9.267979, 48.572014, 221, 11708.2], + [9.266875, 48.57231, 222, 11795.91], + [9.26598, 48.572823, 223, 11882.79], + [9.26598, 48.572823, 224, 11882.79], + [9.264935, 48.57343, 225, 11985.08], + [9.264635, 48.57355, 226, 12011.13], + [9.261692, 48.574, 227, 12233.28], + [9.261086, 48.5742, 228, 12283.11], + [9.260379, 48.574604, 229, 12351.91], + [9.259826, 48.57498, 230, 12410.35], + [9.25946, 48.575294, 231, 12454.14], + [9.258924, 48.575832, 232, 12525.92], + [9.258458, 48.57617, 233, 12576.77], + [9.258458, 48.57617, 234, 12576.77], + [9.257939, 48.57642, 235, 12623.84], + [9.256296, 48.57697, 236, 12759.27], + [9.255569, 48.577282, 237, 12823.14], + [9.254898, 48.57767, 238, 12888.84], + [9.254493, 48.57796, 239, 12932.59], + [9.253862, 48.578484, 240, 13007], + [9.253862, 48.578484, 241, 13007], + [9.252702, 48.579517, 242, 13150.15], + [9.252275, 48.57981, 243, 13195.56], + [9.251576, 48.580135, 244, 13258.39], + [9.250062, 48.580658, 245, 13383.91], + [9.249625, 48.580894, 246, 13425.52], + [9.249326, 48.581116, 247, 13458.69], + [9.24901, 48.581455, 248, 13502.76], + [9.248802, 48.581768, 249, 13541.08], + [9.248239, 48.583054, 250, 13689.92], + [9.247902, 48.583523, 251, 13747.35], + [9.246791, 48.584484, 252, 13882.02], + [9.2457905, 48.585594, 253, 14025.63], + [9.244375, 48.586926, 254, 14206.75], + [9.243945, 48.586933, 255, 14238.36], + ].map(([shape_pt_lon, shape_pt_lat, shape_pt_sequence]) => ({ + shape_pt_lat, + shape_pt_lon, + shape_pt_sequence, + shape_dist_traveled: null, + })) + const schedule = { + id: 'Z1txJMF', + trips: [ + {tripId: '1.T0.31-187-j21-5.9.R', start: 31560}, + {tripId: '3.T0.31-187-j21-5.9.R', start: 38760}, + {tripId: '6.T0.31-187-j21-5.9.R', start: 47760}, + ], + stops: [ + 'de:08116:6956:0:3', + 'de:08116:5901:0:3', + 'de:08116:6846:0:3', + 'de:08116:5900:0:3', + 'de:08116:4463:0:3', + 'de:08116:4312:0:3', + 'de:08116:4465:0:3', + 'de:08116:4464:0:4', + 'de:08116:5772:3:3', + 'de:08116:4490:0:4', + 'de:08116:4316:1:3', + 'de:08116:4315:0:4', + 'de:08116:4313:0:4', + 'de:08116:4311:0:4', + 'de:08116:4310:0:5', + ], + arrivals: [ + 0, 180, 240, 360, + 420, 600, 1080, 1140, + 1320, 1380, 1440, 1500, + 1560, 1620, 1680, + ], + departures: [ + 0, 180, 240, 360, + 420, 600, 1080, 1140, + 1320, 1380, 1440, 1500, + 1560, 1620, 1680, + ], + headwayBasedStarts: [], + headwayBasedEnds: [], + headwayBasedHeadways: [], + } + + const trajectory = await buildTrajectory(shapeId, shapePoints, schedule, stopLocs) + // printTrajectorForDebugging(trajectory, stopLocs) + + t.deepEqual(trajectory.properties, { + shapeId, + scheduleId: 'Z1txJMF', + }) + const coords = trajectory.geometry.coordinates.map(([lon, lat, ...r]) => [ + parseFloat(lon.toFixed(7)), + parseFloat(lat.toFixed(7)), + ...r, + ]) + t.deepEqual(coords, [ + [9.317403, 48.588223, null, -0 , -0], + [9.317306, 48.588215, null, 1, 1], + [9.317215, 48.588135, null, 2, 2], + [9.317332, 48.588062, null, 4, 4], + [9.317419, 48.588055, null, 5, 5], + [9.317668, 48.588116, null, 7, 7], + [9.317728, 48.588165, null, 8, 8], + [9.318756, 48.587875, null, 19, 19], + [9.319731, 48.587845, null, 28, 28], + [9.319697, 48.59, null, 59, 59], + [9.319713, 48.59076, null, 69, 69], + [9.319758, 48.591286, null, 77, 77], + [9.31983, 48.59159, null, 81, 81], + [9.319951, 48.591904, null, 86, 86], + [9.320505, 48.59293, null, 101, 101], + [9.320575, 48.593224, null, 106, 106], + [9.3205805, 48.59359, null, 111, 111], + [9.318464, 48.59288, null, 133, 133], + [9.316523, 48.592136, null, 154, 154], + [9.316053, 48.591915, null, 160, 160], + [9.314853, 48.591248, null, 175, 175], + [9.31436, 48.59106, null, 180, 180], + [9.31436, 48.59106, null, 180, 180], + [9.314013, 48.59097, null, 186, 186], + [9.313734, 48.59094, null, 190, 190], + [9.31174, 48.590824, null, 220, 220], + [9.310376, 48.590702, null, 240, 240], + [9.310376, 48.590702, null, 240, 240], + [9.309253, 48.590584, null, 262, 262], + [9.308971, 48.590607, null, 267, 267], + [9.308756, 48.590664, null, 272, 272], + [9.308814, 48.59076, null, 275, 275], + [9.308836, 48.590885, null, 278, 278], + [9.308924, 48.592297, null, 320, 320], + [9.308896, 48.5924, null, 323, 323], + [9.308635, 48.59265, null, 331, 331], + [9.308454, 48.592922, null, 340, 340], + [9.308369, 48.59321, null, 349, 349], + [9.308365, 48.5936, null, 360, 360], + [9.308365, 48.5936, null, 360, 360], + [9.308491, 48.594112, null, 374, 374], + [9.308734, 48.594578, null, 386, 386], + [9.309101, 48.595, null, 399, 399], + [9.309836, 48.59563, null, 420, 420], + [9.309836, 48.59563, null, 420, 420], + [9.310128, 48.59592, null, 424, 424], + [9.310371, 48.596306, null, 429, 429], + [9.310445, 48.59659, null, 432, 432], + [9.310476, 48.59705, null, 438, 438], + [9.310537, 48.597153, null, 439, 439], + [9.31046, 48.597248, null, 440, 440], + [9.310358, 48.59727, null, 441, 441], + [9.3102455, 48.59725, null, 442, 442], + [9.310154, 48.59715, null, 444, 444], + [9.31003, 48.597095, null, 445, 445], + [9.309127, 48.596844, null, 452, 452], + [9.308051, 48.596603, null, 461, 461], + [9.307133, 48.596447, null, 469, 469], + [9.305925, 48.596348, null, 478, 478], + [9.303994, 48.59634, null, 493, 493], + [9.303229, 48.596275, null, 499, 499], + [9.302737, 48.596203, null, 503, 503], + [9.302112, 48.596058, null, 508, 508], + [9.301599, 48.59589, null, 513, 513], + [9.300727, 48.595493, null, 521, 521], + [9.300202, 48.595158, null, 527, 527], + [9.299765, 48.594788, null, 532, 532], + [9.299312, 48.59428, null, 539, 539], + [9.299105, 48.593937, null, 544, 544], + [9.2989645, 48.59364, null, 547, 547], + [9.29824, 48.59139, null, 575, 575], + [9.299016, 48.591255, null, 581, 581], + [9.301028, 48.591022, null, 597, 597], + [9.30101, 48.59097, null, 597, 597], + [9.301289, 48.590855, null, 600, 600], + [9.301272, 48.590855, null, 600, 600], + [9.301489, 48.590836, null, 602, 602], + [9.301529, 48.590855, null, 602, 602], + [9.301557, 48.590942, null, 603, 603], + [9.300853, 48.591053, null, 608, 608], + [9.29901, 48.591255, null, 622, 622], + [9.298239, 48.591393, null, 628, 628], + [9.297416, 48.589794, null, 647, 647], + [9.296624, 48.588905, null, 658, 658], + [9.295739, 48.5881, null, 669, 669], + [9.295072, 48.587616, null, 676, 676], + [9.294351, 48.58717, null, 684, 684], + [9.293535, 48.586727, null, 691, 691], + [9.292488, 48.58628, null, 700, 700], + [9.290832, 48.58582, null, 714, 714], + [9.289936, 48.585613, null, 721, 721], + [9.289041, 48.585457, null, 727, 727], + [9.286613, 48.585163, null, 746, 746], + [9.283738, 48.58492, null, 767, 767], + [9.282178, 48.584698, null, 778, 778], + [9.280509, 48.584297, null, 791, 791], + [9.27949, 48.58384, null, 801, 801], + [9.278878, 48.58352, null, 806, 806], + [9.278416, 48.583233, null, 811, 811], + [9.277708, 48.582676, null, 819, 819], + [9.277231, 48.5822, null, 825, 825], + [9.276835, 48.5817, null, 832, 832], + [9.276493, 48.581116, null, 838, 838], + [9.276314, 48.580704, null, 843, 843], + [9.275775, 48.57867, null, 866, 866], + [9.275624, 48.57834, null, 870, 870], + [9.275323, 48.577896, null, 875, 875], + [9.275051, 48.57761, null, 879, 879], + [9.274833, 48.57743, null, 882, 882], + [9.274493, 48.577183, null, 885, 885], + [9.274058, 48.57693, null, 890, 890], + [9.273188, 48.576565, null, 897, 897], + [9.271763, 48.57608, null, 909, 909], + [9.271233, 48.57582, null, 914, 914], + [9.270757, 48.57549, null, 919, 919], + [9.2696, 48.57448, null, 933, 933], + [9.269191, 48.574047, null, 939, 939], + [9.26904, 48.573814, null, 941, 941], + [9.268917, 48.573498, null, 945, 945], + [9.268627, 48.5726, null, 955, 955], + [9.268354, 48.572144, null, 961, 961], + [9.268163, 48.571934, null, 963, 963], + [9.268379, 48.57171, null, 966, 966], + [9.268553, 48.57135, null, 970, 970], + [9.268579, 48.57118, null, 972, 972], + [9.268564, 48.570946, null, 975, 975], + [9.2687, 48.570908, null, 976, 976], + [9.268767, 48.570854, null, 977, 977], + [9.26882, 48.570557, null, 980, 980], + [9.269008, 48.57035, null, 983, 983], + [9.269373, 48.57017, null, 986, 986], + [9.269644, 48.570087, null, 988, 988], + [9.270375, 48.56991, null, 994, 994], + [9.270727, 48.56987, null, 997, 997], + [9.271161, 48.569904, null, 1000, 1000], + [9.271636, 48.570038, null, 1004, 1004], + [9.272043, 48.57027, null, 1008, 1008], + [9.272833, 48.5709, null, 1017, 1017], + [9.272914, 48.57086, null, 1017, 1017], + [9.27309, 48.570896, null, 1019, 1019], + [9.273131, 48.570953, null, 1019, 1019], + [9.273077, 48.57104, null, 1020, 1020], + [9.2732, 48.571114, null, 1022, 1022], + [9.273661, 48.57126, null, 1025, 1025], + [9.274422, 48.571598, null, 1032, 1032], + [9.274883, 48.571747, null, 1036, 1036], + [9.275575, 48.571846, null, 1041, 1041], + [9.276374, 48.57178, null, 1047, 1047], + [9.277186, 48.571583, null, 1053, 1053], + [9.277727, 48.571346, null, 1058, 1058], + [9.278713, 48.57076, null, 1068, 1068], + [9.279348, 48.570454, null, 1074, 1074], + [9.281403, 48.56967, null, 1091, 1091], + [9.281728, 48.569584, null, 1094, 1094], + [9.281918, 48.569565, null, 1095, 1095], + [9.282405, 48.56958, null, 1099, 1099], + [9.283111, 48.569805, null, 1104, 1104], + [9.283369, 48.569912, null, 1107, 1107], + [9.284321, 48.57045, null, 1116, 1116], + [9.284756, 48.570656, null, 1120, 1120], + [9.285883, 48.571083, null, 1129, 1129], + [9.286479, 48.571156, null, 1134, 1134], + [9.286764, 48.571136, null, 1136, 1136], + [9.287062, 48.57107, null, 1138, 1138], + [9.287117, 48.571243, null, 1140, 1140], + [9.287065, 48.57161, null, 1145, 1145], + [9.287079, 48.57172, null, 1146, 1146], + [9.28742, 48.572094, null, 1152, 1152], + [9.28842, 48.571724, null, 1161, 1161], + [9.288379, 48.571545, null, 1164, 1164], + [9.288106, 48.571285, null, 1168, 1168], + [9.288119, 48.571274, null, 1168, 1168], + [9.287495, 48.57093, null, 1175, 1175], + [9.286764, 48.57113, null, 1182, 1182], + [9.286372, 48.571148, null, 1185, 1185], + [9.28602, 48.571106, null, 1188, 1188], + [9.285623, 48.570984, null, 1192, 1192], + [9.284536, 48.57055, null, 1202, 1202], + [9.284536, 48.57055, null, 1202, 1202], + [9.283461, 48.569946, null, 1214, 1214], + [9.282974, 48.569744, null, 1219, 1219], + [9.282409, 48.56958, null, 1224, 1224], + [9.282023, 48.569553, null, 1228, 1228], + [9.281741, 48.56958, null, 1230, 1230], + [9.281404, 48.56967, null, 1233, 1233], + [9.2796755, 48.57032, null, 1250, 1250], + [9.279024, 48.5706, null, 1257, 1257], + [9.277451, 48.571476, null, 1274, 1274], + [9.276917, 48.57166, null, 1279, 1279], + [9.276384, 48.571774, null, 1284, 1284], + [9.275732, 48.57184, null, 1289, 1289], + [9.275158, 48.571796, null, 1294, 1294], + [9.274522, 48.571625, null, 1300, 1300], + [9.273939, 48.571358, null, 1306, 1306], + [9.273284, 48.571136, null, 1312, 1312], + [9.273086, 48.57104, null, 1314, 1314], + [9.272993, 48.57107, null, 1315, 1315], + [9.272891, 48.57106, null, 1316, 1316], + [9.2728815, 48.571182, null, 1318, 1318], + [9.272611, 48.57117, null, 1320, 1320], + [9.272611, 48.57117, null, 1320, 1320], + [9.272009, 48.57101, null, 1337, 1337], + [9.271187, 48.570858, null, 1360, 1360], + [9.2713585, 48.570362, null, 1440, 1440], + [9.2713585, 48.570362, null, 1440, 1440], + [9.271514, 48.56999, null, 1447, 1447], + [9.271037, 48.56988, null, 1453, 1453], + [9.270488, 48.569885, null, 1460, 1460], + [9.269508, 48.570126, null, 1473, 1473], + [9.269108, 48.57029, null, 1479, 1479], + [9.268895, 48.570457, null, 1483, 1483], + [9.26881, 48.5706, null, 1486, 1486], + [9.26877, 48.570847, null, 1491, 1491], + [9.268707, 48.5709, null, 1492, 1492], + [9.268566, 48.570942, null, 1494, 1494], + [9.268574, 48.571274, null, 1500, 1500], + [9.268574, 48.571274, null, 1500, 1500], + [9.26851, 48.571472, null, 1501, 1501], + [9.268386, 48.571705, null, 1503, 1503], + [9.268171, 48.571926, null, 1505, 1505], + [9.267979, 48.572014, null, 1506, 1506], + [9.266875, 48.57231, null, 1511, 1511], + [9.26598, 48.572823, null, 1517, 1517], + [9.26598, 48.572823, null, 1517, 1517], + [9.264935, 48.57343, null, 1523, 1523], + [9.264635, 48.57355, null, 1525, 1525], + [9.261692, 48.574, null, 1539, 1539], + [9.261086, 48.5742, null, 1542, 1542], + [9.260379, 48.574604, null, 1546, 1546], + [9.259826, 48.57498, null, 1550, 1550], + [9.25946, 48.575294, null, 1552, 1552], + [9.258924, 48.575832, null, 1557, 1557], + [9.258458, 48.57617, null, 1560, 1560], + [9.258458, 48.57617, null, 1560, 1560], + [9.257939, 48.57642, null, 1567, 1567], + [9.256296, 48.57697, null, 1586, 1586], + [9.255569, 48.577282, null, 1594, 1594], + [9.254898, 48.57767, null, 1604, 1604], + [9.254493, 48.57796, null, 1610, 1610], + [9.253862, 48.578484, null, 1620, 1620], + [9.253862, 48.578484, null, 1620, 1620], + [9.252702, 48.579517, null, 1627, 1627], + [9.252275, 48.57981, null, 1629, 1629], + [9.251576, 48.580135, null, 1632, 1632], + [9.250062, 48.580658, null, 1638, 1638], + [9.249625, 48.580894, null, 1640, 1640], + [9.249326, 48.581116, null, 1642, 1642], + [9.24901, 48.581455, null, 1644, 1644], + [9.248802, 48.581768, null, 1646, 1646], + [9.248239, 48.583054, null, 1653, 1653], + [9.247902, 48.583523, null, 1656, 1656], + [9.246791, 48.584484, null, 1662, 1662], + [9.2457905, 48.585594, null, 1669, 1669], + [9.244375, 48.586926, null, 1678, 1678], + [9.243945, 48.586933, null, 1680, 1680], + ]) +})