@squawk/flightplan 0.10.1 → 0.12.0
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/README.md +26 -7
- package/dist/resolver.d.ts +16 -0
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +99 -14
- package/dist/route-distance.d.ts +14 -3
- package/dist/route-distance.d.ts.map +1 -1
- package/dist/route-distance.js +6 -3
- package/dist/route-geometry.d.ts +5 -0
- package/dist/route-geometry.d.ts.map +1 -1
- package/dist/route-geometry.js +22 -8
- package/dist/route-timing.d.ts +2 -0
- package/dist/route-timing.d.ts.map +1 -1
- package/dist/route-timing.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,8 +120,8 @@ Each element has a `type` discriminant and a `raw` field with the original token
|
|
|
120
120
|
| Type | Description | Key fields |
|
|
121
121
|
| --------------- | ----------------------------------------- | ---------------------------------------------------------------------------- |
|
|
122
122
|
| `airport` | Resolved airport (ICAO or FAA ID) | `airport` |
|
|
123
|
-
| `sid` | Standard Instrument Departure | `procedure`, `legs`, `transition`
|
|
124
|
-
| `star` | Standard Terminal Arrival Route | `procedure`, `legs`, `transition`
|
|
123
|
+
| `sid` | Standard Instrument Departure | `procedure`, `legs`, `transition`, `airportMismatch` |
|
|
124
|
+
| `star` | Standard Terminal Arrival Route | `procedure`, `legs`, `transition`, `airportMismatch` |
|
|
125
125
|
| `airway` | Airway segment between entry and exit fix | `airway`, `entryFix`, `exitFix`, `waypoints`, `gaps`, `unusable`, `reversed` |
|
|
126
126
|
| `direct` | DCT (direct) indicator | - |
|
|
127
127
|
| `waypoint` | Resolved fix or navaid | `fix` and/or `navaid`, `lat`, `lon` |
|
|
@@ -192,6 +192,17 @@ which is how routes are usually filed (`KJFK DEEZZ6 CANDR`). Otherwise the
|
|
|
192
192
|
common route alone is expanded. The `sid` or `star` element records the merged
|
|
193
193
|
transition in `transition`.
|
|
194
194
|
|
|
195
|
+
Many procedure identifiers are published as a separate adaptation at each of
|
|
196
|
+
several airports, and the adaptations' legs differ (PANGG7 has seven common
|
|
197
|
+
legs at 05C and five at KMDW). A SID is matched to the route's departure
|
|
198
|
+
airport, the last airport before it, and a STAR to the arrival airport, the
|
|
199
|
+
first airport after it. When no adaptation serves that airport the first one
|
|
200
|
+
published is expanded, so the route still draws, and the element carries the
|
|
201
|
+
airport in `airportMismatch`: the route files the procedure at an airport it
|
|
202
|
+
does not serve, so it is not valid as filed. A STAR with no airport after it,
|
|
203
|
+
or a SID with none before it, is expanded from the first adaptation without a
|
|
204
|
+
flag.
|
|
205
|
+
|
|
195
206
|
A procedure that cannot be expanded is marked `unresolved`: either the dotted
|
|
196
207
|
transition is not one of its transitions, or the procedure has no common route
|
|
197
208
|
(some SIDs and STARs are published as transitions only) and no adjacent fix
|
|
@@ -203,10 +214,18 @@ When a token could match multiple entity types (e.g. a 3-letter code matching
|
|
|
203
214
|
both an airport and a navaid), the resolver uses this priority order:
|
|
204
215
|
|
|
205
216
|
1. Airway (if previous waypoint context exists and next token available)
|
|
206
|
-
2.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
217
|
+
2. Navaid, when the token is an airport's FAA ID, names a navaid, and is
|
|
218
|
+
directly followed by an airway that lists it as a waypoint
|
|
219
|
+
3. Airport (ICAO or FAA ID)
|
|
220
|
+
4. Procedure (SID/STAR)
|
|
221
|
+
5. Fix
|
|
222
|
+
6. Navaid
|
|
223
|
+
|
|
224
|
+
Rule 2 covers the hundreds of airports that share their FAA ID with a navaid,
|
|
225
|
+
sometimes miles apart: ahead of an airway, `SAT` in `SAT Q24 LSU` is the SAT
|
|
226
|
+
VORTAC the airway is joined at, 6.6 nm from San Antonio's airport. Anywhere
|
|
227
|
+
else the token is the airport, and an ICAO code (`KSAT`) always names the
|
|
228
|
+
airport.
|
|
210
229
|
|
|
211
230
|
The same fix or navaid identifier is sometimes published in more than one
|
|
212
231
|
region. When the `fixes` or `navaids` provider exposes `byIdentAtPosition`, the
|
|
@@ -240,7 +259,7 @@ console.log(result.totalDistanceNm, result.estimatedTimeEnrouteHrs);
|
|
|
240
259
|
|
|
241
260
|
**Returns:** `RouteDistanceResult` with:
|
|
242
261
|
|
|
243
|
-
- `legs` - ordered `RouteLeg` values, each with `from`/`to` point labels, their `fromLat`/`fromLon`/`toLat`/`toLon` coordinates in decimal degrees, `distanceNm`, `cumulativeDistanceNm`, `crossesGap`, which is true when the leg spans a published gap in the airway it came from (the leg is a straight line that counts toward the total but is not a flyable airway segment),
|
|
262
|
+
- `legs` - ordered `RouteLeg` values, each with `from`/`to` point labels, their `fromLat`/`fromLon`/`toLat`/`toLon` coordinates in decimal degrees, `distanceNm`, `cumulativeDistanceNm`, `crossesGap`, which is true when the leg spans a published gap in the airway it came from (the leg is a straight line that counts toward the total but is not a flyable airway segment), `unusable`, which is true when the leg is an airway segment the FAA marks unusable (counted toward the total but not to be flown), and `procedureAirportMismatch`, which is true when the leg runs along a SID or STAR filed at an airport it does not serve (the element's `airportMismatch`), or joins the route to that airport: the leg in from the departure airport for a SID, the leg out to the arrival airport for a STAR
|
|
244
263
|
- `totalDistanceNm` - total great-circle distance in nautical miles
|
|
245
264
|
- `estimatedTimeEnrouteHrs` - ETE in hours, or `undefined` when no ground speed was given
|
|
246
265
|
- `unresolvedElements` - route elements that could not contribute coordinates
|
package/dist/resolver.d.ts
CHANGED
|
@@ -100,6 +100,14 @@ export interface SidRouteElement {
|
|
|
100
100
|
procedure: Procedure;
|
|
101
101
|
/** Name of the transition merged into `legs`: the one named in a dotted token (`DEEZZ6.CANDR`), or the fix following the SID when it names one of the procedure's transitions. Absent when only the common route was expanded. */
|
|
102
102
|
transition?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Identifier of the route's departure airport (the last airport before the
|
|
105
|
+
* SID) when no published adaptation of the procedure serves it. The SID is
|
|
106
|
+
* still expanded, from the first adaptation published, so the route can be
|
|
107
|
+
* drawn and measured, but it is not valid as filed. Absent when an
|
|
108
|
+
* adaptation serves the departure airport or the route names none.
|
|
109
|
+
*/
|
|
110
|
+
airportMismatch?: string;
|
|
103
111
|
/** Ordered legs for the procedure expansion. */
|
|
104
112
|
legs: ProcedureLeg[];
|
|
105
113
|
}
|
|
@@ -115,6 +123,14 @@ export interface StarRouteElement {
|
|
|
115
123
|
procedure: Procedure;
|
|
116
124
|
/** Name of the transition merged into `legs`: the one named in a dotted token (`AALLE4.BBOTL`), or the waypoint preceding the STAR when it names one of the procedure's transitions. Absent when only the common route was expanded. */
|
|
117
125
|
transition?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Identifier of the route's arrival airport (the first airport after the
|
|
128
|
+
* STAR) when no published adaptation of the procedure serves it. The STAR
|
|
129
|
+
* is still expanded, from the first adaptation published, so the route can
|
|
130
|
+
* be drawn and measured, but it is not valid as filed. Absent when an
|
|
131
|
+
* adaptation serves the arrival airport or the route names none.
|
|
132
|
+
*/
|
|
133
|
+
airportMismatch?: string;
|
|
118
134
|
/** Ordered legs for the procedure expansion. */
|
|
119
135
|
legs: ProcedureLeg[];
|
|
120
136
|
}
|
package/dist/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,SAAS,EACT,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,MAAM,EACN,SAAS,EACT,YAAY,EACb,MAAM,eAAe,CAAC;AAMvB;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,mEAAmE;IACnE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC5C,sDAAsD;IACtD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,OAAO,CAAC,KAAK,EAAE,MAAM,GAA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AAY,CAAC;IACnB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,sBAAsB,GACtB,yBAAyB,GACzB,sBAAsB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAMD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,8BAA8B;IAC9B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,iCAAiC;IACjC,UAAU,CAAC,EAAE,yBAAyB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;OAQG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAAC;CACzC;AAkXD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CA6L/F"}
|
package/dist/resolver.js
CHANGED
|
@@ -100,9 +100,13 @@ function tryAirport(token, airports) {
|
|
|
100
100
|
/**
|
|
101
101
|
* Attempts to resolve a token as a SID or STAR procedure at a given
|
|
102
102
|
* airport context. The airport context is the identifier of the most
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
103
|
+
* route's departure airport for a SID (the last airport before the token)
|
|
104
|
+
* and its arrival airport for a STAR (the first airport after it), since
|
|
105
|
+
* one identifier is often published as a separate adaptation at each of
|
|
106
|
+
* several airports, and the adaptations' legs differ. When no adaptation
|
|
107
|
+
* serves that airport, the first one published is expanded and the element
|
|
108
|
+
* carries `airportMismatch`; when the route names no such airport, the
|
|
109
|
+
* first one is expanded without a flag.
|
|
106
110
|
*
|
|
107
111
|
* Accepts both the bare CIFP identifier (e.g. `DEEZZ6`) and the dotted
|
|
108
112
|
* identifier-with-transition form (e.g. `DEEZZ6.CANDR`). A dotted
|
|
@@ -118,7 +122,7 @@ function tryAirport(token, airports) {
|
|
|
118
122
|
* expanded: the dotted transition is not one of its transitions, or it
|
|
119
123
|
* has no common route and no adjacent fix names a transition.
|
|
120
124
|
*/
|
|
121
|
-
function tryProcedure(token, procedures,
|
|
125
|
+
function tryProcedure(token, procedures, previousAirport, resolveNextAirport, previousWaypoint, nextToken) {
|
|
122
126
|
if (!procedures) {
|
|
123
127
|
return undefined;
|
|
124
128
|
}
|
|
@@ -132,14 +136,20 @@ function tryProcedure(token, procedures, airportContext, previousWaypoint, nextT
|
|
|
132
136
|
if (candidates.length === 0) {
|
|
133
137
|
return undefined;
|
|
134
138
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
// The arrival airport is only looked up when a STAR candidate needs it.
|
|
140
|
+
let nextAirport;
|
|
141
|
+
let nextAirportResolved = false;
|
|
142
|
+
function routeAirportFor(candidate) {
|
|
143
|
+
if (candidate.type !== 'STAR') {
|
|
144
|
+
return previousAirport;
|
|
145
|
+
}
|
|
146
|
+
if (!nextAirportResolved) {
|
|
147
|
+
nextAirport = resolveNextAirport();
|
|
148
|
+
nextAirportResolved = true;
|
|
149
|
+
}
|
|
150
|
+
return nextAirport;
|
|
142
151
|
}
|
|
152
|
+
const proc = candidates.find((c) => servesAirport(c, routeAirportFor(c))) ?? candidates[0];
|
|
143
153
|
if (proc === undefined || proc.type === 'IAP') {
|
|
144
154
|
return undefined;
|
|
145
155
|
}
|
|
@@ -159,8 +169,23 @@ function tryProcedure(token, procedures, airportContext, previousWaypoint, nextT
|
|
|
159
169
|
if (transitionName !== undefined) {
|
|
160
170
|
element.transition = transitionName;
|
|
161
171
|
}
|
|
172
|
+
const routeAirport = routeAirportFor(proc);
|
|
173
|
+
if (routeAirport !== undefined && !servesAirport(proc, routeAirport)) {
|
|
174
|
+
element.airportMismatch = routeAirport;
|
|
175
|
+
}
|
|
162
176
|
return element;
|
|
163
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Whether a procedure adaptation is published for the given airport
|
|
180
|
+
* identifier. An undefined airport is served by nothing.
|
|
181
|
+
*/
|
|
182
|
+
function servesAirport(procedure, airport) {
|
|
183
|
+
if (airport === undefined) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
const upper = airport.toUpperCase();
|
|
187
|
+
return procedure.airports.some((a) => a.toUpperCase() === upper);
|
|
188
|
+
}
|
|
164
189
|
/**
|
|
165
190
|
* Returns the procedure's transition whose name matches the adjacent fix
|
|
166
191
|
* token, in the procedure's own spelling, or `undefined` when there is
|
|
@@ -207,6 +232,55 @@ function tryNavaid(token, navaids, anchor) {
|
|
|
207
232
|
}
|
|
208
233
|
return undefined;
|
|
209
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Resolves a token as the navaid where the following airway is entered, when
|
|
237
|
+
* the token matches an airport by its FAA identifier and also names a navaid
|
|
238
|
+
* that is a waypoint of that airway (`SAT Q24 LSU`, `SJN J108 INK`). Hundreds
|
|
239
|
+
* of airports share their FAA identifier with a navaid, sometimes miles away
|
|
240
|
+
* (San Antonio's airport is 6.6 nm from the SAT VORTAC), and a token directly
|
|
241
|
+
* ahead of an airway names the point the airway is joined at. The navaid is
|
|
242
|
+
* chosen by proximity to that airway waypoint.
|
|
243
|
+
*
|
|
244
|
+
* Returns `undefined`, leaving the token to resolve as the airport, when it
|
|
245
|
+
* matches an airport by ICAO code (an ICAO code always names the airport),
|
|
246
|
+
* matches no airport, is not followed by an airway that lists it, or names no
|
|
247
|
+
* navaid there.
|
|
248
|
+
*/
|
|
249
|
+
function tryAirwayEntryNavaid(token, nextToken, airports, navaids, airways) {
|
|
250
|
+
if (!airports || !navaids || !airways || nextToken === undefined) {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
if (airports.byIcao(token) !== undefined || airports.byFaaId(token) === undefined) {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
for (const airway of airways.byDesignation(nextToken)) {
|
|
257
|
+
const entry = airway.waypoints.find((w) => w.identifier?.toUpperCase() === token);
|
|
258
|
+
if (entry !== undefined) {
|
|
259
|
+
return tryNavaid(token, navaids, { lat: entry.lat, lon: entry.lon });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Identifier of the first airport among the tokens from `start` on, by the
|
|
266
|
+
* same rules the parse applies (a token that resolves as an airway-entry
|
|
267
|
+
* navaid is not an airport), as the airport's ICAO code when it has one and
|
|
268
|
+
* its FAA identifier otherwise. Returns `undefined` when none follows. Used
|
|
269
|
+
* as the arrival airport of a STAR.
|
|
270
|
+
*/
|
|
271
|
+
function findNextAirport(tokens, start, airports, navaids, airways) {
|
|
272
|
+
for (let j = start; j < tokens.length; j++) {
|
|
273
|
+
const token = tokens[j].toUpperCase();
|
|
274
|
+
if (tryAirwayEntryNavaid(token, tokens[j + 1]?.toUpperCase(), airports, navaids, airways)) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const airportElement = tryAirport(token, airports);
|
|
278
|
+
if (airportElement) {
|
|
279
|
+
return airportElement.airport.icao ?? airportElement.airport.faaId;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
210
284
|
// ---------------------------------------------------------------------------
|
|
211
285
|
// Main parse implementation
|
|
212
286
|
// ---------------------------------------------------------------------------
|
|
@@ -334,13 +408,23 @@ export function createFlightplanResolver(options) {
|
|
|
334
408
|
i++;
|
|
335
409
|
continue;
|
|
336
410
|
}
|
|
411
|
+
// An FAA airport identifier that also names a navaid on the airway
|
|
412
|
+
// that follows is where the airway is joined, not the airport.
|
|
413
|
+
const entryNavaid = tryAirwayEntryNavaid(token, tokens[i + 1]?.toUpperCase(), airports, navaids, airways);
|
|
414
|
+
if (entryNavaid) {
|
|
415
|
+
elements.push(entryNavaid);
|
|
416
|
+
lastWaypointIdent = token;
|
|
417
|
+
lastPosition = { lat: entryNavaid.lat, lon: entryNavaid.lon };
|
|
418
|
+
i++;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
337
421
|
// Try airport
|
|
338
422
|
const airportElement = tryAirport(token, airports);
|
|
339
423
|
if (airportElement) {
|
|
340
424
|
elements.push(airportElement);
|
|
341
425
|
// Preserve the token as lastWaypointIdent so a following airway can
|
|
342
|
-
// use it as the entry fix
|
|
343
|
-
//
|
|
426
|
+
// still use it as the entry fix when no navaid lookup resolved it
|
|
427
|
+
// above.
|
|
344
428
|
lastWaypointIdent = token;
|
|
345
429
|
lastAirportIdent = airportElement.airport.icao ?? airportElement.airport.faaId;
|
|
346
430
|
lastPosition = { lat: airportElement.airport.lat, lon: airportElement.airport.lon };
|
|
@@ -349,7 +433,8 @@ export function createFlightplanResolver(options) {
|
|
|
349
433
|
}
|
|
350
434
|
// Try procedure (SID/STAR). The fix after a SID or before a STAR may
|
|
351
435
|
// name the transition when the token itself does not.
|
|
352
|
-
const
|
|
436
|
+
const nextIndex = i + 1;
|
|
437
|
+
const procElement = tryProcedure(token, procedures, lastAirportIdent, () => findNextAirport(tokens, nextIndex, airports, navaids, airways), lastWaypointIdent, tokens[i + 1]?.toUpperCase());
|
|
353
438
|
if (procElement) {
|
|
354
439
|
elements.push(procElement);
|
|
355
440
|
if (procElement.type === 'unresolved') {
|
package/dist/route-distance.d.ts
CHANGED
|
@@ -37,6 +37,15 @@ export interface RouteLeg {
|
|
|
37
37
|
* not be flown, so the route is not valid as filed.
|
|
38
38
|
*/
|
|
39
39
|
unusable: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether this leg runs along, or joins the route to, a SID or STAR the
|
|
42
|
+
* route files at an airport no adaptation of it serves (the procedure
|
|
43
|
+
* element's `airportMismatch`): the procedure's own legs, plus the leg in
|
|
44
|
+
* from the departure airport for a SID or out to the arrival airport for a
|
|
45
|
+
* STAR. The leg is measured like any other, but the route is not valid as
|
|
46
|
+
* filed.
|
|
47
|
+
*/
|
|
48
|
+
procedureAirportMismatch: boolean;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
* Result of computing route distance and estimated time enroute from a
|
|
@@ -71,9 +80,11 @@ export interface RouteDistanceResult {
|
|
|
71
80
|
* Airway segments use the FAA-published segment distance where the source
|
|
72
81
|
* publishes a positive one and the airway element says which direction it is
|
|
73
82
|
* flown in, falling back to great-circle computation otherwise. A leg that spans a published gap in its airway is still measured
|
|
74
|
-
* as a straight line and counted, but is flagged with `crossesGap`,
|
|
75
|
-
* on an airway segment the FAA marks unusable is flagged with `unusable`,
|
|
76
|
-
*
|
|
83
|
+
* as a straight line and counted, but is flagged with `crossesGap`, a leg
|
|
84
|
+
* on an airway segment the FAA marks unusable is flagged with `unusable`, and
|
|
85
|
+
* a leg along or into a procedure filed at an airport it does not serve is
|
|
86
|
+
* flagged with `procedureAirportMismatch`, so the caller can see that the
|
|
87
|
+
* route is not valid as filed.
|
|
77
88
|
*
|
|
78
89
|
* ```typescript
|
|
79
90
|
* import { createFlightplanResolver, computeRouteDistance } from '@squawk/flightplan';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-distance.d.ts","sourceRoot":"","sources":["../src/route-distance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO/D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,IAAI,E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;IAC3D,eAAe,EAAE,MAAM,CAAC;IACxB,uFAAuF;IACvF,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C;;;;OAIG;IACH,kBAAkB,EAAE,YAAY,EAAE,CAAC;CACpC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,mBAAmB,CAyCrB"}
|
package/dist/route-distance.js
CHANGED
|
@@ -23,9 +23,11 @@ import { extractGeoPoints } from './route-geometry.js';
|
|
|
23
23
|
* Airway segments use the FAA-published segment distance where the source
|
|
24
24
|
* publishes a positive one and the airway element says which direction it is
|
|
25
25
|
* flown in, falling back to great-circle computation otherwise. A leg that spans a published gap in its airway is still measured
|
|
26
|
-
* as a straight line and counted, but is flagged with `crossesGap`,
|
|
27
|
-
* on an airway segment the FAA marks unusable is flagged with `unusable`,
|
|
28
|
-
*
|
|
26
|
+
* as a straight line and counted, but is flagged with `crossesGap`, a leg
|
|
27
|
+
* on an airway segment the FAA marks unusable is flagged with `unusable`, and
|
|
28
|
+
* a leg along or into a procedure filed at an airport it does not serve is
|
|
29
|
+
* flagged with `procedureAirportMismatch`, so the caller can see that the
|
|
30
|
+
* route is not valid as filed.
|
|
29
31
|
*
|
|
30
32
|
* ```typescript
|
|
31
33
|
* import { createFlightplanResolver, computeRouteDistance } from '@squawk/flightplan';
|
|
@@ -63,6 +65,7 @@ export function computeRouteDistance(route, groundSpeedKt) {
|
|
|
63
65
|
cumulativeDistanceNm: totalDistanceNm,
|
|
64
66
|
crossesGap: from.gapToNext === true,
|
|
65
67
|
unusable: from.unusableToNext === true,
|
|
68
|
+
procedureAirportMismatch: from.procedureMismatchToNext === true,
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
71
|
const estimatedTimeEnrouteHrs = groundSpeedKt !== undefined && groundSpeedKt > 0 ? totalDistanceNm / groundSpeedKt : undefined;
|
package/dist/route-geometry.d.ts
CHANGED
|
@@ -50,6 +50,11 @@ export interface GeoPoint {
|
|
|
50
50
|
* marks unusable.
|
|
51
51
|
*/
|
|
52
52
|
unusableToNext?: true;
|
|
53
|
+
/**
|
|
54
|
+
* Set when the leg from this point to the next runs along, or joins the
|
|
55
|
+
* route to, a SID or STAR filed at an airport no adaptation of it serves.
|
|
56
|
+
*/
|
|
57
|
+
procedureMismatchToNext?: true;
|
|
53
58
|
}
|
|
54
59
|
/**
|
|
55
60
|
* Walks the route elements and extracts an ordered array of geographic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-geometry.d.ts","sourceRoot":"","sources":["../src/route-geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM/D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;CACb;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"route-geometry.d.ts","sourceRoot":"","sources":["../src/route-geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM/D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;CACb;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,IAAI,CAAC;CAChC;AAuBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG;IAC1D,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,kBAAkB,EAAE,YAAY,EAAE,CAAC;CACpC,CA0HA;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,EAAE,CAGnE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,CAS5E"}
|
package/dist/route-geometry.js
CHANGED
|
@@ -53,14 +53,17 @@ export function extractGeoPoints(elements) {
|
|
|
53
53
|
last.precomputedDistanceToNextNm === undefined) {
|
|
54
54
|
last.precomputedDistanceToNextNm = point.precomputedDistanceToNextNm;
|
|
55
55
|
}
|
|
56
|
-
// Likewise carry a gap or
|
|
57
|
-
//
|
|
56
|
+
// Likewise carry a gap, unusable or procedure-mismatch marker, so the
|
|
57
|
+
// leg out of the merged point is still reported.
|
|
58
58
|
if (point.gapToNext) {
|
|
59
59
|
last.gapToNext = true;
|
|
60
60
|
}
|
|
61
61
|
if (point.unusableToNext) {
|
|
62
62
|
last.unusableToNext = true;
|
|
63
63
|
}
|
|
64
|
+
if (point.procedureMismatchToNext) {
|
|
65
|
+
last.procedureMismatchToNext = true;
|
|
66
|
+
}
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
69
|
points.push(point);
|
|
@@ -115,14 +118,25 @@ export function extractGeoPoints(elements) {
|
|
|
115
118
|
break;
|
|
116
119
|
}
|
|
117
120
|
case 'sid':
|
|
118
|
-
case 'star':
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
case 'star': {
|
|
122
|
+
// A procedure filed at an airport it does not serve flags its own legs
|
|
123
|
+
// and the leg joining it to that airport: the leg in from the
|
|
124
|
+
// departure for a SID, the leg out to the arrival for a STAR.
|
|
125
|
+
const mismatched = el.airportMismatch !== undefined;
|
|
126
|
+
if (mismatched && el.type === 'sid' && points.length > 0) {
|
|
127
|
+
points[points.length - 1].procedureMismatchToNext = true;
|
|
124
128
|
}
|
|
129
|
+
const drawable = el.legs.flatMap((leg) => leg.fixIdentifier !== undefined && leg.lat !== undefined && leg.lon !== undefined
|
|
130
|
+
? [{ label: leg.fixIdentifier, lat: leg.lat, lon: leg.lon }]
|
|
131
|
+
: []);
|
|
132
|
+
drawable.forEach((point, index) => {
|
|
133
|
+
if (mismatched && (el.type === 'star' || index < drawable.length - 1)) {
|
|
134
|
+
point.procedureMismatchToNext = true;
|
|
135
|
+
}
|
|
136
|
+
emit(point);
|
|
137
|
+
});
|
|
125
138
|
break;
|
|
139
|
+
}
|
|
126
140
|
case 'unresolved':
|
|
127
141
|
unresolvedElements.push(el);
|
|
128
142
|
break;
|
package/dist/route-timing.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ export interface RouteTimingLeg {
|
|
|
72
72
|
crossesGap: boolean;
|
|
73
73
|
/** Whether this leg is an airway segment the FAA marks unusable, as on `RouteLeg`. */
|
|
74
74
|
unusable: boolean;
|
|
75
|
+
/** Whether this leg runs along or into a procedure filed at an airport it does not serve, as on `RouteLeg`. */
|
|
76
|
+
procedureAirportMismatch: boolean;
|
|
75
77
|
/** Initial great-circle true course for the leg in degrees (0-360). */
|
|
76
78
|
trueCourseDeg: number;
|
|
77
79
|
/** True heading to fly to hold the course given the wind, in degrees (0-360). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-timing.d.ts","sourceRoot":"","sources":["../src/route-timing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO/D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,KAA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;IAC7F,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,mGAAmG;IACnG,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC;;;OAGG;IACH,kBAAkB,EAAE,YAAY,EAAE,CAAC;CACpC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB,CA2FnB"}
|
package/dist/route-timing.js
CHANGED
|
@@ -102,6 +102,7 @@ export function computeRouteTiming(route, options) {
|
|
|
102
102
|
cumulativeDistanceNm: leg.cumulativeDistanceNm,
|
|
103
103
|
crossesGap: leg.crossesGap,
|
|
104
104
|
unusable: leg.unusable,
|
|
105
|
+
procedureAirportMismatch: leg.procedureAirportMismatch,
|
|
105
106
|
trueCourseDeg,
|
|
106
107
|
trueHeadingDeg: triangle.trueHeadingDeg,
|
|
107
108
|
windCorrectionAngleDeg: triangle.windCorrectionAngleDeg,
|