Skip to main content

Class: FacilityLoader

Defined in: src/sdk/navigation/FacilityLoader.ts:195

A class that handles loading facility data from the simulator.

Implements

Constructors

Constructor

new FacilityLoader(facilityRepo, onInitialized, options?): FacilityLoader

Defined in: src/sdk/navigation/FacilityLoader.ts:234

Creates an instance of the FacilityLoader.

Parameters

ParameterTypeDescription
facilityRepoFacilityRepositoryA local facility repository.
onInitialized() => voidA callback to call when the facility loader has completed initialization.
options?Readonly<FacilityLoaderOptions>Options with which to configure the loader.

Returns

FacilityLoader

Properties

onInitialized()

readonly onInitialized: () => void

Defined in: src/sdk/navigation/FacilityLoader.ts:236

A callback to call when the facility loader has completed initialization.

Returns

void

Methods

awaitInitialization()

awaitInitialization(): Promise<void>

Defined in: src/sdk/navigation/FacilityLoader.ts:277

Waits until this facility loader is initialized.

Returns

Promise<void>

A Promise which is fulfilled when this facility loader is initialized.

Implementation of

FacilityClient.awaitInitialization


findNearestFacilitiesByIdent()

findNearestFacilitiesByIdent<T>(filter, ident, lat, lon, maxItems): Promise<SearchTypeMap[T][]>

Defined in: src/sdk/navigation/FacilityLoader.ts:889

Searches for facilities matching a given ident, and returns the matching facilities, with nearest at the beginning of the array.

Type Parameters

Type Parameter
T extends FacilitySearchTypeLatLon

Parameters

ParameterTypeDefault valueDescription
filterTundefinedThe type of facility to filter by. Selecting ALL will search all facility type ICAOs, except for boundary facilities.
identstringundefinedThe exact ident to search for. (ex: DEN, KDEN, ITADO)
latnumberundefinedThe latitude to find facilities nearest to.
lonnumberundefinedThe longitude to find facilities nearest to.
maxItemsnumber40The maximum number of matches to return. Defaults to 40.

Returns

Promise<SearchTypeMap[T][]>

An array of matching facilities, sorted by distance to the given lat/lon, with nearest at the beginning of the array.

Implementation of

FacilityClient.findNearestFacilitiesByIdent


getAirway()

Call Signature

getAirway(airwayName, airwayType, icao): Promise<AirwayData>

Defined in: src/sdk/navigation/FacilityLoader.ts:542

Retrieves data for an airway.

Parameters
ParameterTypeDescription
airwayNamestringThe airway name.
airwayTypenumberThe airway type.
icaoIcaoValueThe ICAO value of one intersection in the airway.
Returns

Promise<AirwayData>

The retrieved airway data.

Throws

Error if the specified airway data could not be retrieved.

Implementation of

FacilityClient.getAirway

Call Signature

getAirway(airwayName, airwayType, icao): Promise<AirwayData>

Defined in: src/sdk/navigation/FacilityLoader.ts:544

Retrieves data for an airway.

Parameters
ParameterTypeDescription
airwayNamestringThe airway name.
airwayTypenumberThe airway type.
icaostringThe ICAO string (V1) of one intersection in the airway.
Returns

Promise<AirwayData>

The retrieved airway data.

Throws

Error if the specified airway data could not be retrieved.

Deprecated

Please use the signature that takes an IcaoValue instead.

Implementation of

FacilityClient.getAirway


getFacilities()

getFacilities(icaos, airportDataFlags?): Promise<(null | Facility)[]>

Defined in: src/sdk/navigation/FacilityLoader.ts:305

Retrieves a batch of facilities. The type of each facility to retrieve is inferred from the requested ICAO.

Parameters

ParameterTypeDescription
icaosreadonly IcaoValue[]The ICAO values of facilities to retrieve.
airportDataFlags?numberBitflags describing the requested data to be loaded in the airport facilities to retrieve. The retrieved airport facilities are guaranteed to have at least as much loaded data as requested. Defaults to AirportFacilityDataFlags.All.

Returns

Promise<(null | Facility)[]>

A Promise which will be fulfilled with an array of the requested facilities. Each position in the facilities array will contain either the facility for the ICAO at the corresponding position in the ICAO array, or null if a facility for that ICAO could not be retrieved.

Implementation of

FacilityClient.getFacilities


getFacilitiesOfType()

Call Signature

getFacilitiesOfType<T>(type, icaos): Promise<(null | FacilityTypeMap[T])[]>

Defined in: src/sdk/navigation/FacilityLoader.ts:319

Retrieves a batch of facilities of a given type.

Type Parameters
Type Parameter
T extends FacilityType
Parameters
ParameterTypeDescription
typeTThe type of facilities to retrieve.
icaosreadonly IcaoValue[]The ICAO values of facilities to retrieve.
Returns

Promise<(null | FacilityTypeMap[T])[]>

A Promise which will be fulfilled with an array of the requested facilities. Each position in the facilities array will contain either the facility for the ICAO at the corresponding position in the ICAO array, or null if a facility for that ICAO could not be retrieved.

Implementation of

FacilityClient.getFacilitiesOfType

Call Signature

getFacilitiesOfType(type, icaos, airportDataFlags?): Promise<(null | AirportFacility)[]>

Defined in: src/sdk/navigation/FacilityLoader.ts:321

Retrieves a batch of airport facilities.

Parameters
ParameterTypeDescription
typeAirportThe type of facilities to retrieve.
icaosreadonly IcaoValue[]The ICAO values of facilities to retrieve.
airportDataFlags?numberBitflags describing the requested data to be loaded in the airport facilities to retrieve. The retrieved airport facilities are guaranteed to have at least as much loaded data as requested. Defaults to AirportFacilityDataFlags.All.
Returns

Promise<(null | AirportFacility)[]>

A Promise which will be fulfilled with an array of the requested facilities. Each position in the facilities array will contain either the facility for the ICAO at the corresponding position in the ICAO array, or null if a facility for that ICAO could not be retrieved.

Implementation of

FacilityClient.getFacilitiesOfType


getFacility()

Call Signature

getFacility<T>(type, icao, airportDataFlags?): Promise<FacilityTypeMap[T]>

Defined in: src/sdk/navigation/FacilityLoader.ts:287

Retrieves a facility.

Type Parameters
Type Parameter
T extends FacilityType
Parameters
ParameterTypeDescription
typeTThe type of facility to retrieve.
icaoIcaoValueThe ICAO of the facility to retrieve.
airportDataFlags?numberBitflags describing the requested data to be loaded in the airport facility to retrieve. The retrieved airport facility (if any) is guaranteed to have at least as much loaded data as requested. Ignored if type is not FacilityType.Airport. Defaults to AirportFacilityDataFlags.All.
Returns

Promise<FacilityTypeMap[T]>

A Promise which will be fulfilled with the requested facility, or rejected if the facility could not be retrieved.

Implementation of

FacilityClient.getFacility

Call Signature

getFacility<T>(type, icao): Promise<FacilityTypeMap[T]>

Defined in: src/sdk/navigation/FacilityLoader.ts:289

Retrieves a facility.

Type Parameters
Type Parameter
T extends FacilityType
Parameters
ParameterTypeDescription
typeTThe type of facility to retrieve.
icaostringThe ICAO of the facility to retrieve.
Returns

Promise<FacilityTypeMap[T]>

A Promise which will be fulfilled with the requested facility, or rejected if the facility could not be retrieved.

Deprecated

Please use the signature that takes an IcaoValue instead.

Implementation of

FacilityClient.getFacility


getMetar()

Call Signature

getMetar(airport): Promise<undefined | Metar>

Defined in: src/sdk/navigation/FacilityLoader.ts:719

Gets a METAR for an airport.

Parameters
ParameterTypeDescription
airportAirportFacilityAn airport.
Returns

Promise<undefined | Metar>

The METAR for the airport, or undefined if none could be obtained.

Implementation of

FacilityClient.getMetar

Call Signature

getMetar(ident): Promise<undefined | Metar>

Defined in: src/sdk/navigation/FacilityLoader.ts:721

Gets a METAR for an airport.

Parameters
ParameterTypeDescription
identstringAn airport ident.
Returns

Promise<undefined | Metar>

The METAR for the airport, or undefined if none could be obtained.

Implementation of

FacilityClient.getMetar


getTaf()

Call Signature

getTaf(airport): Promise<undefined | Taf>

Defined in: src/sdk/navigation/FacilityLoader.ts:771

Gets a TAF for an airport.

Parameters
ParameterTypeDescription
airportAirportFacilityAn airport.
Returns

Promise<undefined | Taf>

The TAF for the airport, or undefined if none could be obtained.

Implementation of

FacilityClient.getTaf

Call Signature

getTaf(ident): Promise<undefined | Taf>

Defined in: src/sdk/navigation/FacilityLoader.ts:773

Gets a TAF for an airport.

Parameters
ParameterTypeDescription
identstringAn airport ident.
Returns

Promise<undefined | Taf>

The TAF for the airport, or undefined if none could be obtained.

Implementation of

FacilityClient.getTaf


searchByIdent()

searchByIdent(filter, ident, maxItems): Promise<string[]>

Defined in: src/sdk/navigation/FacilityLoader.ts:859

Searches for ICAOs by their ident portion only.

Parameters

ParameterTypeDefault valueDescription
filterFacilitySearchTypeundefinedThe type of facility to filter by. Selecting ALL will search all facility type ICAOs.
identstringundefinedThe partial or complete ident to search for.
maxItemsnumber40The maximum number of matches to return. Defaults to 40.

Returns

Promise<string[]>

An array of matched ICAOs. Exact matches are sorted before partial matches.

Deprecated

Please use searchByIdentWithIcaoStruct() instead.

Implementation of

FacilityClient.searchByIdent


searchByIdentWithIcaoStructs()

searchByIdentWithIcaoStructs(filter, ident, maxItems): Promise<IcaoValue[]>

Defined in: src/sdk/navigation/FacilityLoader.ts:829

Searches for ICAOs by their ident portion only.

Parameters

ParameterTypeDefault valueDescription
filterFacilitySearchTypeundefinedThe type of facility to filter by. Selecting ALL will search all facility type ICAOs.
identstringundefinedThe partial or complete ident to search for.
maxItemsnumber40The maximum number of matches to return. Defaults to 40.

Returns

Promise<IcaoValue[]>

An array of matched ICAOs. Exact matches are sorted before partial matches.

Implementation of

FacilityClient.searchByIdentWithIcaoStructs


searchMetar()

searchMetar(lat, lon): Promise<undefined | Metar>

Defined in: src/sdk/navigation/FacilityLoader.ts:734

Searches for the METAR issued for the closest airport to a given location.

Parameters

ParameterTypeDescription
latnumberThe latitude of the center of the search, in degrees.
lonnumberThe longitude of the center of the search, in degrees.

Returns

Promise<undefined | Metar>

The METAR issued for the closest airport to the given location, or undefined if none could be found.

Implementation of

FacilityClient.searchMetar


searchTaf()

searchTaf(lat, lon): Promise<undefined | Taf>

Defined in: src/sdk/navigation/FacilityLoader.ts:786

Searches for the TAF issued for the closest airport to a given location.

Parameters

ParameterTypeDescription
latnumberThe latitude of the center of the search, in degrees.
lonnumberThe longitude of the center of the search, in degrees.

Returns

Promise<undefined | Taf>

The TAF issued for the closest airport to the given location, or undefined if none could be found.

Implementation of

FacilityClient.searchTaf


startNearestSearchSession()

startNearestSearchSession<T>(type): Promise<NearestSessionTypeMap<StringV1>[T]>

Defined in: src/sdk/navigation/FacilityLoader.ts:619

Starts a nearest facilities search session. If the requested session type provides ICAOs as results, then the ICAOs will be provided as ICAO strings (V1).

Type Parameters

Type Parameter
T extends FacilitySearchType

Parameters

ParameterTypeDescription
typeTThe type of facilities for which to search.

Returns

Promise<NearestSessionTypeMap<StringV1>[T]>

A Promise which will be fulfilled with the new nearest search session.

Deprecated

Please use startNearestSearchSessionWithIcaoStructs() instead.

Implementation of

FacilityClient.startNearestSearchSession


startNearestSearchSessionWithIcaoStructs()

startNearestSearchSessionWithIcaoStructs<T>(type): Promise<NearestSessionTypeMap<Struct>[T]>

Defined in: src/sdk/navigation/FacilityLoader.ts:597

Starts a nearest facilities search session. If the requested session type provides ICAOs as results, then the ICAOs will be provided as IcaoValue objects.

Type Parameters

Type Parameter
T extends FacilitySearchType

Parameters

ParameterTypeDescription
typeTThe type of facilities for which to search.

Returns

Promise<NearestSessionTypeMap<Struct>[T]>

A Promise which will be fulfilled with the new nearest search session.

Implementation of

FacilityClient.startNearestSearchSessionWithIcaoStructs


tryGetAirway()

tryGetAirway(airwayName, airwayType, icao): Promise<null | AirwayData>

Defined in: src/sdk/navigation/FacilityLoader.ts:537

Attempts to retrieve data for an airway.

Parameters

ParameterTypeDescription
airwayNamestringThe airway name.
airwayTypenumberThe airway type.
icaoIcaoValueThe ICAO value of one intersection in the airway.

Returns

Promise<null | AirwayData>

The retrieved airway data, or null if data could not be retrieved.

Implementation of

FacilityClient.tryGetAirway


tryGetFacility()

tryGetFacility<T>(type, icao, airportDataFlags?): Promise<null | FacilityTypeMap[T]>

Defined in: src/sdk/navigation/FacilityLoader.ts:282

Attempts to retrieve a facility.

Type Parameters

Type Parameter
T extends FacilityType

Parameters

ParameterTypeDescription
typeTThe type of facility to retrieve.
icaoIcaoValueThe ICAO of the facility to retrieve.
airportDataFlags?numberBitflags describing the requested data to be loaded in the airport facility to retrieve. The retrieved airport facility (if any) is guaranteed to have at least as much loaded data as requested. Ignored if type is not FacilityType.Airport. Defaults to AirportFacilityDataFlags.All.

Returns

Promise<null | FacilityTypeMap[T]>

A Promise which will be fulfilled with the requested facility, or null if the facility could not be retrieved.

Implementation of

FacilityClient.tryGetFacility


getDatabaseCycles()

static getDatabaseCycles(): FacilityDatabaseCycles

Defined in: src/sdk/navigation/FacilityLoader.ts:966

Gets the AIRAC cycles associated with the facility database.

Returns

FacilityDatabaseCycles

an object containing the previous, current, and next cycles. If an error occurs and the MSFS facility cycle cannot be determined, the effective cycle for the current date is used instead.