Today I added a function for retrieval of airport/runway information.
Usage:
var apt = airportinfo("KHAF"); # get info about KHAF
var apt = airportinfo(lat, lon); # get info about apt closest to lat/lon
var apt = airportinfo(); # get info about apt closest to aircraft
The command debug.dump(airportinfo("KHAF")) outputs this:
{ lon : -122.4962626410256, lat : 37.51343502564102, has_metar : 0,
runways : { 12 : { stopway2 : 0, threshold1 : 232.5624,
lon : -122.5010889999999, lat : 37.513831, stopway1 : 0, width : 45.72,
threshold2 : 232.5624, heading : 138.1199999999999, length : 1523.0856 } },
elevation : 20.42159999999999, id : "KHAF", name : "Half Moon Bay" }
That is: a hash with elements lat/lon/elev/id/name/has_metar for the
airport, and a hash with runways, each of which consists of lat/lon/
/length/width/heading/threshold[12]/stopway[12]. Only one side of each
runway is listed -- the other can easily be deduced.
Unfortunately, the C++ search functions don't differ yet between
airport and heliport, so you might not get the "closest airport"
that you expect. :-)
There are some runway values missing, such as lighting info, but
that's easy to add once we need it. Thanks to the hash structure
we don't have to fear compatibility problems.
The function should, of course, be used sparingly, but it's fast
enough to not cause stutter. ;-)
m.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel