VR-Forces 4.10 Lua Function Documentation

airportDataUtils

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

Functions that compute information of interest about airports and runways. Several functions take runway or airport FeatureSets as arguments. These can be retrieved with the vrf:getFeatures... functions, e.g.

 runwayFeatureSet = vrf:getFeaturesWithinRange(myDepartureFlightPlan[1]["location"], 10000, {query="MAK_RUNWAYS"}) airportFeatureSet = vrf:getFeaturesWithinRange(myDepartureFlightPlan[1]["location"], 10000, {query="MAK_AIRPORTS"}) 

To use these functions, the script must use the require command and refer to the module:
local ap = require "airportDataUtils"
runwayRoute = ap.findSuitableRunway(...

Function List

findAirportInfo (location, airportFeatureSet) Finds the code (ICAO) and elevation of the closest airport to the specified location.
findSuitableRunway (location, internalRunwayFeatures, internalAirportFeatures, desiredHeading, minLength, departure) Creates a route object defining a runway that a simulated aircraft can land on.
runwayEndpoints (featureSet, index, airportElevation) Returns the start and end of a runway, based on the indexed locations of the featureSet parameter.


Functions

findAirportInfo (location, airportFeatureSet)
Finds the code (ICAO) and elevation of the closest airport to the specified location. Requires that airportFeatures data set is already loaded.

Parameters:

  • location:
  • airportFeatureSet:

Return value:

    code, elevation (two values)
findSuitableRunway (location, internalRunwayFeatures, internalAirportFeatures, desiredHeading, minLength, departure)
Creates a route object defining a runway that a simulated aircraft can land on.

Parameters:

  • location: Location3D -- Finds the airport closest to the location.
  • internalRunwayFeatures: is a runway featureSet.
  • internalAirportFeatures: is an airport featureSet.
  • desiredHeading: is the desired heading of the runway. A runway at the airport near location will be selected to best match this heading.
  • minLength: is the minimum length runway to accept.
  • departure: is a boolean to indicate whether this is an arrival or departure.

Return value:

    simObject that is the runway. It is a route with two points.
runwayEndpoints (featureSet, index, airportElevation)
Returns the start and end of a runway, based on the indexed locations of the featureSet parameter. featureSet is a runway FeatureSet. airport elevation is the altitude at which to set the endpoints.

Parameters:

  • featureSet:
  • index:
  • airportElevation:

Return value:

    a table of two Location3D.

Copyright© 2021 MAK Technologies, Inc. All rights reserved.