@golemio/pid 4.2.0-rc.2113470662 → 4.2.1-dev.2113429421
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/migrations/postgresql/20251020110708-get-departures-add-aftertrack.js +53 -0
- package/db/migrations/postgresql/sqls/20251020110708-get-departures-add-aftertrack-down.sql +284 -0
- package/db/migrations/postgresql/sqls/20251020110708-get-departures-add-aftertrack-up.sql +289 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.d.ts +6 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +288 -236
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +1 -0
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/SkipHelper.js +9 -2
- package/dist/output-gateway/pid/models/helpers/SkipHelper.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js +2 -1
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/interfaces/PublicParamsInterfaces.d.ts +1 -0
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
- package/dist/output-gateway/public/routers/v2/V2PublicDeparturesRouter.js +1 -0
- package/dist/output-gateway/public/routers/v2/V2PublicDeparturesRouter.js.map +1 -1
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.d.ts +1 -1
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js +6 -7
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js.map +1 -1
- package/docs/openapi-output.yaml +9 -0
- package/package.json +2 -2
|
@@ -34,257 +34,309 @@ class DelayComputationManager {
|
|
|
34
34
|
constructor(gtfsTripsRepository) {
|
|
35
35
|
this.gtfsTripsRepository = gtfsTripsRepository;
|
|
36
36
|
this.METRO_TRIP_PREFIX_REGEX = /^(991|992|993)/;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
const simpleConfig = ioc_1.IntegrationEngineContainer.resolve(CoreToken_1.CoreToken.SimpleConfig);
|
|
38
|
+
this.stepBetweenPoints = config_1.config.vehiclePositions.stepBetweenPoints;
|
|
39
|
+
this.stepBetweenPointsforMetro = Number(simpleConfig.getValue("module.pid.vehicle-positions.shapes.metro.stepBetweenPointsForMetro", "0.05"));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Return shape anchor points along trip track shape with stop times parameters
|
|
43
|
+
*
|
|
44
|
+
* @param {string} tripId - Internal DB trip id
|
|
45
|
+
* @returns {IComputationTrip} - Result with shape anchor points
|
|
46
|
+
*/
|
|
47
|
+
async getComputationObject(tripId) {
|
|
48
|
+
const gtfsTrip = await this.gtfsTripsRepository.findByIdForDelayComputation(tripId);
|
|
49
|
+
if (!gtfsTrip) {
|
|
50
|
+
helpers_1.log.info(`getComputationObject: GTFS trip ${tripId} was not found`);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const { shape_id, shapes, stop_times } = gtfsTrip;
|
|
54
|
+
if (!shapes?.length) {
|
|
55
|
+
throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no shapes`, this.constructor.name);
|
|
56
|
+
}
|
|
57
|
+
else if (!stop_times?.length) {
|
|
58
|
+
throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no stop_times`, this.constructor.name);
|
|
59
|
+
}
|
|
60
|
+
const isMetro = this.METRO_TRIP_PREFIX_REGEX.test(tripId);
|
|
61
|
+
const shapesGeometryAnchorPoints = this.getShapesGeometryAnchorPoints(shape_id, shapes, stop_times, isMetro);
|
|
62
|
+
// MAKING COPY
|
|
63
|
+
const shapePoints = [];
|
|
64
|
+
const lastPointIndex = shapesGeometryAnchorPoints.length - 1;
|
|
65
|
+
// const to determine shape points of stops (in meters)
|
|
66
|
+
const distanceBefore = 0.1;
|
|
67
|
+
const distanceAfter = 0.05;
|
|
68
|
+
for (let i = 0; i < shapesGeometryAnchorPoints.length; i++) {
|
|
69
|
+
const isLastPoint = i === lastPointIndex;
|
|
70
|
+
const bearing = this.setupBearingBetweenPoints(i, shapesGeometryAnchorPoints, shapePoints, isLastPoint);
|
|
71
|
+
// init values
|
|
72
|
+
let thisStopSequence = null;
|
|
73
|
+
let lastStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
|
|
74
|
+
let nextStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
|
|
75
|
+
// these are origin stop_times shape point fron shapes table, clearly at stops points
|
|
76
|
+
if (shapesGeometryAnchorPoints[i].this_stop_sequence) {
|
|
77
|
+
thisStopSequence = shapesGeometryAnchorPoints[i].this_stop_sequence;
|
|
48
78
|
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
79
|
+
// if is shape anchor point in close distance AFTER LAST stop, then set it also AT STOP
|
|
80
|
+
else if (i > 0 &&
|
|
81
|
+
shapesGeometryAnchorPoints[i].shape_dist_traveled -
|
|
82
|
+
stop_times[shapesGeometryAnchorPoints[i].last_stop_sequence - 1].shape_dist_traveled <=
|
|
83
|
+
distanceAfter) {
|
|
84
|
+
thisStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
|
|
52
85
|
}
|
|
53
|
-
|
|
54
|
-
|
|
86
|
+
// if is shape anchor point in close distance BEFORE NEXT stop, then set it also AT STOP
|
|
87
|
+
else if (i < shapesGeometryAnchorPoints.length - 1 &&
|
|
88
|
+
stop_times[shapesGeometryAnchorPoints[i].next_stop_sequence - 1].shape_dist_traveled -
|
|
89
|
+
shapesGeometryAnchorPoints[i].shape_dist_traveled <=
|
|
90
|
+
distanceBefore) {
|
|
91
|
+
thisStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
|
|
92
|
+
lastStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
|
|
93
|
+
nextStopSequence = Math.min(shapesGeometryAnchorPoints[i].next_stop_sequence + 1, stop_times.length);
|
|
55
94
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
for (let i = 0; i < shapesGeometryAnchorPoints.length; i++) {
|
|
64
|
-
let bearing = 0;
|
|
65
|
-
// add bearing from shape computed for previous shapePoint
|
|
66
|
-
if (i > 0) {
|
|
67
|
-
// compute bearing from two shape points
|
|
68
|
-
let shapePointBearing = Math.round(turf.bearing(turf.point(shapesGeometryAnchorPoints[i - 1].coordinates), turf.point(shapesGeometryAnchorPoints[i].coordinates)));
|
|
69
|
-
// turf.bearing returns -180 to 180, when 0 is north
|
|
70
|
-
// we need 0 to 359, for negative value we substract from 360
|
|
71
|
-
if (shapePointBearing < 0) {
|
|
72
|
-
shapePointBearing = 360 - Math.abs(shapePointBearing);
|
|
73
|
-
}
|
|
74
|
-
// save bearing
|
|
75
|
-
shapePoints[i - 1].bearing = shapePointBearing;
|
|
76
|
-
// for the last shapePoint copy the bearing from last one
|
|
77
|
-
if (shapesGeometryAnchorPoints.length - 1 === i) {
|
|
78
|
-
bearing = shapePoints[i - 1].bearing;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// init values
|
|
82
|
-
let thisStopSequence = null;
|
|
83
|
-
let lastStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
|
|
84
|
-
let nextStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
|
|
85
|
-
// these are origin stop_times shape point fron shapes table, clearly at stops points
|
|
86
|
-
if (shapesGeometryAnchorPoints[i].this_stop_sequence) {
|
|
87
|
-
thisStopSequence = shapesGeometryAnchorPoints[i].this_stop_sequence;
|
|
88
|
-
}
|
|
89
|
-
// if is shape anchor point in close distance AFTER LAST stop, then set it also AT STOP
|
|
90
|
-
else if (i > 0 &&
|
|
91
|
-
shapesGeometryAnchorPoints[i].shape_dist_traveled -
|
|
92
|
-
stop_times[shapesGeometryAnchorPoints[i].last_stop_sequence - 1].shape_dist_traveled <=
|
|
93
|
-
distanceAfter) {
|
|
94
|
-
thisStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
|
|
95
|
-
}
|
|
96
|
-
// if is shape anchor point in close distance BEFORE NEXT stop, then set it also AT STOP
|
|
97
|
-
else if (i < shapesGeometryAnchorPoints.length - 1 &&
|
|
98
|
-
stop_times[shapesGeometryAnchorPoints[i].next_stop_sequence - 1].shape_dist_traveled -
|
|
99
|
-
shapesGeometryAnchorPoints[i].shape_dist_traveled <=
|
|
100
|
-
distanceBefore) {
|
|
101
|
-
thisStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
|
|
102
|
-
lastStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
|
|
103
|
-
nextStopSequence = Math.min(shapesGeometryAnchorPoints[i].next_stop_sequence + 1, stop_times.length);
|
|
104
|
-
}
|
|
105
|
-
let shapeDistTraveled = shapesGeometryAnchorPoints[i].shape_dist_traveled;
|
|
106
|
-
let distanceFromLastStop;
|
|
107
|
-
// fallback to shape_dist_traveled from GTFS stop_times, if the vehicle is at stop
|
|
108
|
-
// and set distance from last stop to 0 (the stop is literally at stop)
|
|
109
|
-
if (thisStopSequence !== null) {
|
|
110
|
-
shapeDistTraveled = stop_times[thisStopSequence - 1].shape_dist_traveled;
|
|
111
|
-
distanceFromLastStop = 0;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
distanceFromLastStop =
|
|
115
|
-
Math.round((shapeDistTraveled - stop_times[lastStopSequence - 1].shape_dist_traveled) * 1000) / 1000;
|
|
116
|
-
}
|
|
117
|
-
// if is trip at stop than set departure by this stop
|
|
118
|
-
// between stops do linear interpolation from departure from last stop and arrival of next stop
|
|
119
|
-
const timeScheduledSeconds = thisStopSequence !== null
|
|
120
|
-
? stop_times[lastStopSequence - 1].arrival_time_seconds
|
|
121
|
-
: stop_times[lastStopSequence - 1].departure_time_seconds +
|
|
122
|
-
Math.round(((stop_times[nextStopSequence - 1].arrival_time_seconds -
|
|
123
|
-
stop_times[lastStopSequence - 1].departure_time_seconds) *
|
|
124
|
-
distanceFromLastStop) /
|
|
125
|
-
(stop_times[nextStopSequence - 1].shape_dist_traveled -
|
|
126
|
-
stop_times[lastStopSequence - 1].shape_dist_traveled));
|
|
127
|
-
shapePoints.push({
|
|
128
|
-
index: i,
|
|
129
|
-
at_stop: thisStopSequence !== null,
|
|
130
|
-
bearing,
|
|
131
|
-
coordinates: shapesGeometryAnchorPoints[i].coordinates,
|
|
132
|
-
distance_from_last_stop: distanceFromLastStop,
|
|
133
|
-
last_stop_sequence: lastStopSequence,
|
|
134
|
-
next_stop_sequence: nextStopSequence,
|
|
135
|
-
shape_dist_traveled: shapeDistTraveled,
|
|
136
|
-
this_stop_sequence: thisStopSequence,
|
|
137
|
-
time_scheduled_seconds: timeScheduledSeconds,
|
|
138
|
-
});
|
|
95
|
+
let shapeDistTraveled = shapesGeometryAnchorPoints[i].shape_dist_traveled;
|
|
96
|
+
let distanceFromLastStop;
|
|
97
|
+
// fallback to shape_dist_traveled from GTFS stop_times, if the vehicle is at stop
|
|
98
|
+
// and set distance from last stop to 0 (the stop is literally at stop)
|
|
99
|
+
if (thisStopSequence !== null) {
|
|
100
|
+
shapeDistTraveled = stop_times[thisStopSequence - 1].shape_dist_traveled;
|
|
101
|
+
distanceFromLastStop = 0;
|
|
139
102
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
103
|
+
else {
|
|
104
|
+
distanceFromLastStop = this.roundToDecimals(shapeDistTraveled - stop_times[lastStopSequence - 1].shape_dist_traveled, 1000);
|
|
105
|
+
}
|
|
106
|
+
// if is trip at stop than set departure by this stop
|
|
107
|
+
// between stops do linear interpolation from departure from last stop and arrival of next stop
|
|
108
|
+
const timeScheduledSeconds = thisStopSequence !== null
|
|
109
|
+
? stop_times[lastStopSequence - 1].arrival_time_seconds
|
|
110
|
+
: stop_times[lastStopSequence - 1].departure_time_seconds +
|
|
111
|
+
Math.round(((stop_times[nextStopSequence - 1].arrival_time_seconds -
|
|
112
|
+
stop_times[lastStopSequence - 1].departure_time_seconds) *
|
|
113
|
+
distanceFromLastStop) /
|
|
114
|
+
(stop_times[nextStopSequence - 1].shape_dist_traveled -
|
|
115
|
+
stop_times[lastStopSequence - 1].shape_dist_traveled));
|
|
116
|
+
shapePoints.push({
|
|
117
|
+
index: i,
|
|
118
|
+
at_stop: thisStopSequence !== null,
|
|
119
|
+
bearing,
|
|
120
|
+
coordinates: shapesGeometryAnchorPoints[i].coordinates,
|
|
121
|
+
distance_from_last_stop: distanceFromLastStop,
|
|
122
|
+
last_stop_sequence: lastStopSequence,
|
|
123
|
+
next_stop_sequence: nextStopSequence,
|
|
124
|
+
shape_dist_traveled: shapeDistTraveled,
|
|
125
|
+
this_stop_sequence: thisStopSequence,
|
|
126
|
+
time_scheduled_seconds: timeScheduledSeconds,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
trip_id: tripId,
|
|
131
|
+
stop_times: stop_times,
|
|
132
|
+
shapes_anchor_points: shapePoints,
|
|
133
|
+
shapes: this.mapGtfsShapesToTripShapes(shapes),
|
|
146
134
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
135
|
+
}
|
|
136
|
+
roundToDecimals(n, fraction = 100000) {
|
|
137
|
+
return Math.round(n * fraction) / fraction;
|
|
138
|
+
}
|
|
139
|
+
shouldReadCoordsFromPrevPoint(points, i) {
|
|
140
|
+
if (i <= 1) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
return (points[i].coordinates[0] === points[i - 1].coordinates[0] && points[i].coordinates[1] === points[i - 1].coordinates[1]);
|
|
144
|
+
}
|
|
145
|
+
setupBearingBetweenPoints(index, source, target, isLast) {
|
|
146
|
+
// add bearing from shape computed for previous shapePoint
|
|
147
|
+
if (index === 0) {
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
let bearing;
|
|
151
|
+
if (index > 1 && source[index - 1].this_stop_sequence && !source[index].this_stop_sequence) {
|
|
152
|
+
// Was the previous point at_stop? We'll ignore any bearing computation,
|
|
153
|
+
// it would point possibly to the after stop segment, usually behind a cross
|
|
154
|
+
// or after a curve. Thus we'll use the at_stop's incoming (prev point) bearing,
|
|
155
|
+
// because vehicle stays at_stop for some time, then it starts moving
|
|
156
|
+
// and we compute bearing in the 1st point after the stop in next iteration
|
|
157
|
+
return target[index - 1].bearing;
|
|
158
|
+
}
|
|
159
|
+
if (this.shouldReadCoordsFromPrevPoint(source, index)) {
|
|
160
|
+
// take bearing of the previous point (i - 1),
|
|
161
|
+
// as long as current point and prev. point have same coords
|
|
162
|
+
// ... to be saved into previous point (i - 1)
|
|
163
|
+
bearing = target[index - 1].bearing;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// compute bearing from two shape points
|
|
167
|
+
bearing = turf.bearing(turf.point(source[index - 1].coordinates), turf.point(source[index].coordinates));
|
|
168
|
+
}
|
|
169
|
+
// turf.bearing returns -180 to 180, when 0 is north
|
|
170
|
+
// we need 0 to 359 => modulo 360
|
|
171
|
+
bearing = Math.round((360 + bearing) % 360);
|
|
172
|
+
// save bearing
|
|
173
|
+
target[index - 1].bearing = bearing;
|
|
174
|
+
// for the last shapePoint copy the bearing from last computed one
|
|
175
|
+
if (isLast) {
|
|
176
|
+
bearing = target[index - 1].bearing;
|
|
177
|
+
}
|
|
178
|
+
return bearing;
|
|
179
|
+
}
|
|
180
|
+
shapePointCompareDistance(point, currentStop, nextStop) {
|
|
181
|
+
if (currentStop.shape_dist_traveled === point.shape_dist_traveled) {
|
|
182
|
+
point.shape_at_stop = true;
|
|
183
|
+
}
|
|
184
|
+
if (nextStop) {
|
|
185
|
+
if (point.shape_dist_traveled >= currentStop.shape_dist_traveled &&
|
|
186
|
+
point.shape_dist_traveled <= nextStop.shape_dist_traveled) {
|
|
187
|
+
// current segment
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
190
|
+
else if (point.shape_dist_traveled > nextStop.shape_dist_traveled) {
|
|
191
|
+
// future segment
|
|
192
|
+
return 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// previous stop segment OR missing nextStop (currentStop is last stop)
|
|
196
|
+
return -1;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Return geometry of anchor points with distance from start along trip track shape
|
|
200
|
+
*
|
|
201
|
+
* @param {string} shapeId - GTFS shape id
|
|
202
|
+
* @param {ITransformedTripShape[]} shapes - GTFS shape points
|
|
203
|
+
* @param {IStopTime[]} stops
|
|
204
|
+
* @returns {IShapeGeometryAnchorPoint[]} - Result array of geometry points along trip track shape
|
|
205
|
+
*/
|
|
206
|
+
getShapesGeometryAnchorPoints(shapeId, shapes, stops, isMetro = false) {
|
|
207
|
+
try {
|
|
208
|
+
let segmentShapes = [];
|
|
209
|
+
// Splits shapes array to multiple arrays "delimited" by stops
|
|
210
|
+
let startShapeIndex = 0;
|
|
211
|
+
for (let st = 0; st < stops.length; st++) {
|
|
212
|
+
const currentSegment = [];
|
|
213
|
+
for (let sh = startShapeIndex; sh < shapes.length; sh++) {
|
|
214
|
+
const shapePoint = { ...shapes[sh], shape_at_stop: false };
|
|
215
|
+
const shapePointSituation = this.shapePointCompareDistance(shapePoint, stops[st], stops[st + 1]);
|
|
216
|
+
if (shapePointSituation === 0) {
|
|
217
|
+
// next stop iteration (outer for-cycle) can be shorter
|
|
218
|
+
startShapeIndex = sh;
|
|
219
|
+
// each segment starts with "at_stop=true" point
|
|
220
|
+
currentSegment.push(shapePoint);
|
|
171
221
|
}
|
|
172
|
-
if (
|
|
173
|
-
|
|
222
|
+
else if (shapePointSituation === 1) {
|
|
223
|
+
// no need to iterate over all future stops segments
|
|
224
|
+
break;
|
|
174
225
|
}
|
|
175
226
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
for (const segment of segmentShapes) {
|
|
179
|
-
segmentArr = [
|
|
180
|
-
...segmentArr,
|
|
181
|
-
...this.divideSegmentLine(segment, isMetro ? this.stepBetweenPointsforMetro : this.stepBetweenPoints),
|
|
182
|
-
];
|
|
227
|
+
if (currentSegment.length) {
|
|
228
|
+
segmentShapes.push(currentSegment);
|
|
183
229
|
}
|
|
184
|
-
// Make initial shapesGeometryAnchorPoints
|
|
185
|
-
let stopCounter = 0;
|
|
186
|
-
const resultArr = segmentArr.map((segment, index) => {
|
|
187
|
-
let this_stop_sequence;
|
|
188
|
-
let last_stop_sequence;
|
|
189
|
-
let next_stop_sequence;
|
|
190
|
-
if (segment.shape_at_stop) {
|
|
191
|
-
stopCounter++;
|
|
192
|
-
this_stop_sequence = stopCounter;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
this_stop_sequence = null;
|
|
196
|
-
}
|
|
197
|
-
last_stop_sequence = stopCounter;
|
|
198
|
-
next_stop_sequence = stopCounter + 1;
|
|
199
|
-
return {
|
|
200
|
-
index,
|
|
201
|
-
coordinates: [
|
|
202
|
-
Math.round(segment.shape_pt_lon * 100000) / 100000,
|
|
203
|
-
Math.round(segment.shape_pt_lat * 100000) / 100000,
|
|
204
|
-
],
|
|
205
|
-
last_stop_sequence,
|
|
206
|
-
next_stop_sequence,
|
|
207
|
-
shape_dist_traveled: Math.round(segment.shape_dist_traveled * 1000) / 1000,
|
|
208
|
-
this_stop_sequence,
|
|
209
|
-
};
|
|
210
|
-
});
|
|
211
|
-
stopCounter++;
|
|
212
|
-
// and lastly shape point for last stop as there is no segment for last stop
|
|
213
|
-
resultArr.push({
|
|
214
|
-
index: resultArr.length,
|
|
215
|
-
coordinates: [
|
|
216
|
-
Math.round(shapes[shapes.length - 1].shape_pt_lon * 100000) / 100000,
|
|
217
|
-
Math.round(shapes[shapes.length - 1].shape_pt_lat * 100000) / 100000,
|
|
218
|
-
],
|
|
219
|
-
last_stop_sequence: stopCounter,
|
|
220
|
-
next_stop_sequence: stopCounter,
|
|
221
|
-
shape_dist_traveled: Math.round(shapes[shapes.length - 1].shape_dist_traveled * 1000) / 1000,
|
|
222
|
-
this_stop_sequence: stopCounter,
|
|
223
|
-
});
|
|
224
|
-
return resultArr;
|
|
225
230
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
let segmentArr = [];
|
|
232
|
+
// concat arrays of stop divided segments with distributed shape points
|
|
233
|
+
for (const segment of segmentShapes) {
|
|
234
|
+
const line = this.divideSegmentLine(segment, isMetro ? this.stepBetweenPointsforMetro : this.stepBetweenPoints);
|
|
235
|
+
segmentArr.push(...line);
|
|
230
236
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const shapeId = segmentArr[0].shape_id;
|
|
243
|
-
const shapeCount = segmentArr.length;
|
|
244
|
-
const startShapeDistTraveled = segmentArr[0].shape_dist_traveled;
|
|
245
|
-
const endShapeDistTraveled = segmentArr[shapeCount - 1].shape_dist_traveled;
|
|
246
|
-
const shapeDistLength = endShapeDistTraveled - startShapeDistTraveled;
|
|
247
|
-
const segmentLine = turf.lineString(segmentArr.map((s) => {
|
|
248
|
-
return [s.shape_pt_lon, s.shape_pt_lat];
|
|
249
|
-
}));
|
|
250
|
-
// because we dont believe source shape distances, rather compute length with turf.js
|
|
251
|
-
const segmentLength = turf.length(segmentLine);
|
|
252
|
-
const middlePointsCount = Math.floor(segmentLength / distance);
|
|
253
|
-
const distanceOffset = (segmentLength - distance * middlePointsCount) / 2;
|
|
254
|
-
// put first shape point
|
|
255
|
-
const resultSegmentPoints = [
|
|
256
|
-
{
|
|
257
|
-
...segmentArr[0],
|
|
258
|
-
shape_pt_sequence: 1,
|
|
259
|
-
},
|
|
260
|
-
];
|
|
261
|
-
// for each middle point create acording shape point with interpolated origin shape dist traveled
|
|
262
|
-
for (let i = 0; i < middlePointsCount; i++) {
|
|
263
|
-
const currentDistance = i * distance + distanceOffset;
|
|
264
|
-
const currentDistDistance = (shapeDistLength / segmentLength) * currentDistance;
|
|
265
|
-
const newPoint = turf.along(segmentLine, i * distance + distanceOffset);
|
|
266
|
-
resultSegmentPoints.push({
|
|
267
|
-
shape_id: shapeId,
|
|
268
|
-
shape_at_stop: false,
|
|
269
|
-
shape_pt_sequence: resultSegmentPoints.length + 1,
|
|
270
|
-
shape_pt_lat: newPoint.geometry.coordinates[1],
|
|
271
|
-
shape_pt_lon: newPoint.geometry.coordinates[0],
|
|
272
|
-
shape_dist_traveled: startShapeDistTraveled + currentDistDistance,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
return resultSegmentPoints;
|
|
276
|
-
};
|
|
277
|
-
this.mapGtfsShapesToTripShapes = (shapes) => {
|
|
278
|
-
return shapes.map((shape) => {
|
|
237
|
+
// Make initial shapesGeometryAnchorPoints
|
|
238
|
+
let stopCounter = 0;
|
|
239
|
+
const resultArr = segmentArr.map((segment, index) => {
|
|
240
|
+
let this_stop_sequence;
|
|
241
|
+
if (segment.shape_at_stop) {
|
|
242
|
+
stopCounter++;
|
|
243
|
+
this_stop_sequence = stopCounter;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this_stop_sequence = null;
|
|
247
|
+
}
|
|
279
248
|
return {
|
|
280
|
-
|
|
281
|
-
|
|
249
|
+
index,
|
|
250
|
+
...this.getAnchorPointProps(segment.shape_pt_lon, segment.shape_pt_lat, stopCounter, stopCounter + 1, segment.shape_dist_traveled),
|
|
251
|
+
this_stop_sequence,
|
|
282
252
|
};
|
|
283
253
|
});
|
|
254
|
+
stopCounter++;
|
|
255
|
+
// and lastly shape point for last stop as there is no segment for last stop
|
|
256
|
+
resultArr.push({
|
|
257
|
+
index: resultArr.length,
|
|
258
|
+
...this.getAnchorPointProps(shapes[shapes.length - 1].shape_pt_lon, shapes[shapes.length - 1].shape_pt_lat, stopCounter, stopCounter, shapes[shapes.length - 1].shape_dist_traveled),
|
|
259
|
+
this_stop_sequence: stopCounter,
|
|
260
|
+
});
|
|
261
|
+
return resultArr;
|
|
262
|
+
}
|
|
263
|
+
catch (err) {
|
|
264
|
+
helpers_1.log.error(err);
|
|
265
|
+
helpers_1.log.error(shapeId);
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
getAnchorPointProps(lon, lat, last, next, dist) {
|
|
270
|
+
return {
|
|
271
|
+
coordinates: [this.roundToDecimals(lon), this.roundToDecimals(lat)],
|
|
272
|
+
last_stop_sequence: last,
|
|
273
|
+
next_stop_sequence: next,
|
|
274
|
+
shape_dist_traveled: this.roundToDecimals(dist, 1000),
|
|
284
275
|
};
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Generate new shape points from segment of trip shape along original one
|
|
279
|
+
* - preserving start and end shape points belonging to stops
|
|
280
|
+
* - creates new set of shape points between stops to get same point distance along original shape
|
|
281
|
+
*
|
|
282
|
+
* @param {ISegmentShape[]} segmentsArr - Original shape points segment between two stops
|
|
283
|
+
* @param {number} distance - Minimal distance for two consequent shape points
|
|
284
|
+
* @returns {ISegmentShape[]} - Result array of new shape points
|
|
285
|
+
*/
|
|
286
|
+
divideSegmentLine(segmentArr, distance = config_1.config.vehiclePositions.stepBetweenPoints) {
|
|
287
|
+
const shapeId = segmentArr[0].shape_id;
|
|
288
|
+
const shapeCount = segmentArr.length;
|
|
289
|
+
const startShapeDistTraveled = segmentArr[0].shape_dist_traveled;
|
|
290
|
+
const endShapeDistTraveled = segmentArr[shapeCount - 1].shape_dist_traveled;
|
|
291
|
+
const shapeDistLength = endShapeDistTraveled - startShapeDistTraveled;
|
|
292
|
+
const segmentLine = turf.lineString(segmentArr.map((s) => {
|
|
293
|
+
return [s.shape_pt_lon, s.shape_pt_lat];
|
|
294
|
+
}));
|
|
295
|
+
// because we dont believe source shape distances, rather compute length with turf.js
|
|
296
|
+
const segmentLength = turf.length(segmentLine);
|
|
297
|
+
const middlePointsCount = Math.floor(segmentLength / distance);
|
|
298
|
+
const distanceOffset = (segmentLength - distance * middlePointsCount) / 2;
|
|
299
|
+
// put first shape point
|
|
300
|
+
const resultSegmentPoints = [
|
|
301
|
+
{
|
|
302
|
+
...segmentArr[0],
|
|
303
|
+
shape_pt_sequence: 1,
|
|
304
|
+
},
|
|
305
|
+
];
|
|
306
|
+
// for each middle point create acording shape point with interpolated origin shape dist traveled
|
|
307
|
+
for (let i = 0; i < middlePointsCount; i++) {
|
|
308
|
+
const currentDistance = i * distance + distanceOffset;
|
|
309
|
+
const currentDistDistance = (shapeDistLength / segmentLength) * currentDistance;
|
|
310
|
+
// There was an idea to skip possibly really small remaining shape distance
|
|
311
|
+
// to the first computed segment point... but it created possibly more issues
|
|
312
|
+
// with trams/buses having stops at crossings and having bearing into next point
|
|
313
|
+
// behind the crossing. Possibly investigate an option to compute points
|
|
314
|
+
// dynamically on a distance +- 50 meters apart between stops, not just shapes
|
|
315
|
+
// between stops (excluding next stop)
|
|
316
|
+
// const minimalDistanceLimit = distance / 10;
|
|
317
|
+
// if (currentDistDistance < minimalDistanceLimit) {
|
|
318
|
+
// // point would be too close, skip it
|
|
319
|
+
// // continue;
|
|
320
|
+
// }
|
|
321
|
+
const newPoint = turf.along(segmentLine, i * distance + distanceOffset);
|
|
322
|
+
resultSegmentPoints.push({
|
|
323
|
+
shape_id: shapeId,
|
|
324
|
+
shape_at_stop: false,
|
|
325
|
+
shape_pt_sequence: resultSegmentPoints.length + 1,
|
|
326
|
+
shape_pt_lat: this.roundToDecimals(newPoint.geometry.coordinates[1]),
|
|
327
|
+
shape_pt_lon: this.roundToDecimals(newPoint.geometry.coordinates[0]),
|
|
328
|
+
shape_dist_traveled: this.roundToDecimals(startShapeDistTraveled + currentDistDistance, 1000),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
return resultSegmentPoints;
|
|
332
|
+
}
|
|
333
|
+
mapGtfsShapesToTripShapes(shapes) {
|
|
334
|
+
return shapes.map((shape) => {
|
|
335
|
+
return {
|
|
336
|
+
dist: shape.shape_dist_traveled,
|
|
337
|
+
coords: [shape.shape_pt_lon, shape.shape_pt_lat],
|
|
338
|
+
};
|
|
339
|
+
});
|
|
288
340
|
}
|
|
289
341
|
}
|
|
290
342
|
exports.DelayComputationManager = DelayComputationManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wEAAqE;AACrE,yEAAsE;AACtE,2EAAoE;AACpE,mEAAuF;AACvF,6EAAwE;AACxE,iDAAmC;AAGnC,MAAa,uBAAuB;IAKhC,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAJ7D,4BAAuB,GAAG,gBAAgB,CAAC;QAYnD;;;;;WAKG;QACI,yBAAoB,GAAG,KAAK,EAAE,MAAc,EAAoC,EAAE;YACrF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC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AC,eAAe,GAAG,aAAa,CAAC,GAAG,eAAe,CAAC;gBAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,GAAG,cAAc,CAAC,CAAC;gBACxE,mBAAmB,CAAC,IAAI,CAAC;oBACrB,QAAQ,EAAE,OAAO;oBACjB,aAAa,EAAE,KAAK;oBACpB,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC;oBACjD,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;oBAC9C,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;oBAC9C,mBAAmB,EAAE,sBAAsB,GAAG,mBAAmB;iBACpE,CAAC,CAAC;aACN;YACD,OAAO,mBAAmB,CAAC;QAC/B,CAAC,CAAC;QAEM,8BAAyB,GAAG,CAAC,MAAgB,EAA2B,EAAE;YAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACxB,OAAO;oBACH,IAAI,EAAE,KAAK,CAAC,mBAAmB;oBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;iBACnD,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAvSE,MAAM,YAAY,GAAG,gCAA0B,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAC/F,IAAI,CAAC,iBAAiB,GAAG,eAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;QACnE,IAAI,CAAC,yBAAyB,GAAG,MAAM,CACnC,YAAY,CAAC,QAAQ,CAAC,qEAAqE,EAAE,OAAO,CAAC,CACxG,CAAC;IACN,CAAC;CAmSJ;AA9SD,0DA8SC"}
|
|
1
|
+
{"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/hel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GAAG,cAAc,CAAC,CAAC;YACxE,mBAAmB,CAAC,IAAI,CAAC;gBACrB,QAAQ,EAAE,OAAO;gBACjB,aAAa,EAAE,KAAK;gBACpB,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC;gBACjD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,mBAAmB,EAAE,IAAI,CAAC,eAAe,CAAC,sBAAsB,GAAG,mBAAmB,EAAE,IAAI,CAAC;aAChG,CAAC,CAAC;SACN;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEO,yBAAyB,CAAC,MAAgB;QAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACxB,OAAO;gBACH,IAAI,EAAE,KAAK,CAAC,mBAAmB;gBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;aACnD,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApYD,0DAoYC"}
|
|
@@ -45,6 +45,7 @@ export interface IPIDDeparture {
|
|
|
45
45
|
"trip.last_position.this_stop_sequence": number | null;
|
|
46
46
|
"trip.cis_stop_platform_code": string | null;
|
|
47
47
|
"trip.vehicle_descriptor.is_air_conditioned"?: boolean | null;
|
|
48
|
+
"trip.last_position.state_position"?: string | null;
|
|
48
49
|
planned_start_timestamp: string | null;
|
|
49
50
|
}
|
|
50
51
|
export interface ITransferAccessibility {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,4CAA0B;AAC1B,2CAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,4CAA0B;AAC1B,2CAAyB;AA8KzB,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACnB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,yCAAuB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,2CAAwB,CAAA;IACxB,0DAAuC,CAAA;IACvC,oDAAiC,CAAA;IACjC,mEAAgD,CAAA;IAChD,qEAAkD,CAAA;IAClD,8EAA2D,CAAA;AAC/D,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B;AAED,IAAY,aAMX;AAND,WAAY,aAAa;IACrB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,sCAAqB,CAAA;IACrB,mCAAkB,CAAA;IAClB,8BAA8B;AAClC,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB"}
|
|
@@ -24,7 +24,12 @@ class SkipHelper {
|
|
|
24
24
|
return !!lastNumber && lastNumber === tripNumber;
|
|
25
25
|
}
|
|
26
26
|
static hasNoDelayInfo(departure) {
|
|
27
|
-
|
|
27
|
+
if (!("arrival_datetime" in departure)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const statePosition = departure["trip.last_position.state_position"];
|
|
31
|
+
const isFinished = statePosition === "after_track" || statePosition === "after_track_delayed";
|
|
32
|
+
return !departure.is_delay_available || isFinished;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* Used exclusively in departure boards when skip[]=missing is requested (without untracked)
|
|
@@ -99,10 +104,12 @@ class SkipHelper {
|
|
|
99
104
|
if (!("arrival_datetime" in departure)) {
|
|
100
105
|
return false;
|
|
101
106
|
}
|
|
107
|
+
const statePosition = departure["trip.last_position.state_position"];
|
|
102
108
|
const isAtStop = departure.stop_sequence === departure["trip.last_position.this_stop_sequence"];
|
|
103
109
|
const isPassStop = !!departure["trip.last_position.last_stop_sequence"] &&
|
|
104
110
|
departure.stop_sequence <= departure["trip.last_position.last_stop_sequence"];
|
|
105
|
-
|
|
111
|
+
const isFinished = statePosition === "after_track" || statePosition === "after_track_delayed";
|
|
112
|
+
return isAtStop || isPassStop || isFinished;
|
|
106
113
|
}
|
|
107
114
|
static isOutsideStartThreshold(minutesToStart, routeType) {
|
|
108
115
|
const isMetro = routeType === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO;
|