MVCS contains an interface that allows the following aeronautical server-based functions:
aeroServer object.Currently, getMetar() and windsAloft() fetch data from aviationweather.gov, and fcstWeather() fetches data from the Open-Meteo forecast API.
All of the functions reject their Promise with the string 'offline' if the app is offline (ctl.isOnline is false) without contacting the server.
getMetar()aeroServer.getMetar(station)
aeroServer.getMetar(station, distance)
aeroServer.getMetar(station, distance, latitude, longitude)
Retrieve METAR data for a METAR station. Only the METARS issued within the last hour are fetched. If the station has issued more than one METAR in the last hour, they will all be returned. If provided, distance specifies a statute-mile radius from the station to retrieve all METARs. This allows for finding the nearest published conditions if a station does not issue METARs, or for determining better conditions with a reasonable distance from the station. If omitted, only METARs from the station are returned. If provided, latitude and longitude, specify the center of the search radius. If latitude and longitude are provided, the station may be ''.
Returns a Promise that resolves with a Response whose text contains a list of retrieved METARs separated by newlines. The Promise rejects if something goes wrong.
aeroServer.getMetar() calls server.stdOp() to pass the standard headers and arguments in addition to the supplied arguments.
stationdistance (optional)station or latitude and longitude to search for nearby METARs.latitude (optional)latitude is provided, then longitude must also be provided.longitude (optional)longitude is provided, then latitude must also be provided.A Promise that resolves with text containing a list of retrieved METARs separated by newlines, if the status is OK. Otherwise, the Promise is rejected with the returned or timeout Response. The Response can contain the following status codes:
If the app is offline, the Promise is rejected with the string 'offline' instead.
windsAloft()aeroServer.windsAloft()
aeroServer.windsAloft(region)
aeroServer.windsAloft(region, level)
Retrieve winds aloft data for region and level. The region and level values are as specified by the aviationweather.gov data API for "windtemp". If omitted, level defaults to 'low' and region defaults to 'all'.
Returns a Promise that resolves with a Response whose text contains the text retrieved from the aviationweather.gov data API for "windtemp". The Promise rejects if something goes wrong.
Note: the current server-side implementation ignores both region and level and assumes the default values.
aeroServer.windsAloft() calls server.stdOp() to pass the standard headers and arguments in addition to the supplied arguments.
region (optional)aviationweather.gov data API for "windtemp" region string. If omitted, defaults to 'all.levelaviationweather.gov data API for "windtemp" level string. If omitted, defaults to 'low.A Promise that resolves with text containing the text retrieved from the aviationweather.gov data API for "windtemp", if the status is OK. Otherwise, the Promise is rejected with the returned or timeout Response. The Response can contain the following status codes:
If the app is offline, the Promise is rejected with the string 'offline' instead.
fcstWeather()aeroServer.fcstWeather(latitude, longitude, hourly, forecast_hours)
Retrieve forecast weather data for one or more locations from the Open-Meteo forecast API. The latitude and longitude arguments are comma-separated lists, one entry per location. The hourly argument is a comma-separated list of the Open-Meteo hourly variables to fetch for each location, and forecast_hours is the number of forecast hours to fetch.
Returns a Promise that resolves with a Response whose JSON content is the Open-Meteo response: an object for a single location or an array of objects for multiple locations, each with an elevation and an hourly object of time series. The Promise rejects if something goes wrong.
aeroServer.fcstWeather() is normally called by ForecastWeather, which builds the arguments from a route and parses the response.
aeroServer.fcstWeather() calls server.stdOp() to pass the standard headers and arguments in addition to the supplied arguments.
latitudelongitudelatitude.hourly'surface_pressure,freezing_level_height,wind_speed_850hPa'.forecast_hoursA Promise that resolves with a Response containing the JSON forecast data, if the status is OK. Otherwise, the Promise is rejected with the returned or timeout Response, or with the string 'offline' if the app is offline.