This article covers the following platforms
MSFS 2024
MSFS 2020
ATS
FSX
Prepar3D
Use the Weather API to find a METAR — a station’s coded weather report — by station ICAO or by the nearest station to a coordinate.
find_metar_by_icao()
Find the METAR reported by a specific station.
SignatureTypeScript contract
find_metar_by_icao(
icao: string,
callback: (metar: object | null) => void
): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
icao | string | Yes | ICAO code of the station to find. |
callback | (metar: object | null) => void | Yes | Function that receives the METAR or null when no report is found. |
ExampleJavaScript
this.$api.weather.find_metar_by_icao("KJFK", (metar) => {
console.log(metar);
});Returns
voidThe result is delivered to the callback.Callback data
| Name | Type | Description |
|---|---|---|
metar | object | null | Matching METAR, or null when no station report is found. |
find_metar_from_coords()
Find the METAR from the station nearest a coordinate.
SignatureTypeScript contract
find_metar_from_coords(
latitude: number,
longitude: number,
callback: (metar: object | null) => void
): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
latitude | number | Yes | Latitude of the search position. |
longitude | number | Yes | Longitude of the search position. |
callback | (metar: object | null) => void | Yes | Function that receives the nearest METAR or null when none is found. |
ExampleJavaScript
this.$api.weather.find_metar_from_coords(40.6413, -73.7781, (metar) => {
console.log(metar);
});Returns
voidThe result is delivered to the callback.Callback data
| Name | Type | Description |
|---|---|---|
metar | object | null | Nearest METAR, or null when no station report is found. |