Board index FlightGear Development Nasal

Differences between airportinfo() and findAirportsByICAO()

Nasal is the scripting language of FlightGear.

Differences between airportinfo() and findAirportsByICAO()

Postby leechpool » Sun Oct 13, 2019 12:39 pm

Hi,
If I use the following in nasal it finds the airport and works as expected, listing the two runways at Lundy Island:
Code: Select all
# following taken from nasal library examples, with EG69 added as target airport
# prints to lengths of the runways of the nearest airport in feet and metres
var info = airportinfo("EG69");
print("-- Lengths of the runways at ", info.name, " (", info.id, ") --");
foreach(var rwy; keys(info.runways)){
    print(rwy, ": ", math.round(info.runways[rwy].length * M2FT), " ft (", info.runways[rwy].length, " m)");
}

However, If I run the following it's as if the "airport" doesn't exist:
Code: Select all
#again taken from nasal library with EG69 inserted as target
var apt = findAirportsByICAO("EG69"); # one way to check if an airport does exist
if (size(apt) == 0) {
    print("Airport does not exist"); # this one will be printed
} else {
    print("Airport does exist");
}


Could someone please help with why the two find-airport methods give different results.
(I'm using flightgear with Ubuntu 18.04, and it's updated to the latest in the default Ubuntu repos)

Thanks
:)
leechpool
 
Posts: 8
Joined: Thu Aug 01, 2019 8:17 am

Re: Differences between airportinfo() and findAirportsByICAO

Postby wkitty42 » Sun Oct 13, 2019 4:46 pm

is EG69 an airport, heliport or seaport?

the reason i ask is that if you do not specify the type then findAirportsByICAO will default to searching only for airports... if EG69 is a heliport or seaport, it will not be found...

for clarity, this info comes from http://wiki.flightgear.org/Nasal_library#findAirportsByICAO.28.29 which i suspect you have already looked at...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5700
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Differences between airportinfo() and findAirportsByICAO

Postby leechpool » Sun Oct 13, 2019 6:13 pm

Hi wkitty,
I believe it's an airport. It consist of a grass strip on a small island. I had considered type but assumed the default "airport" would be ok because that's all I'm interested in.....
It's as though the airportinfo and findairportsbyICAO are using different databases.
thanks
:)
leechpool
 
Posts: 8
Joined: Thu Aug 01, 2019 8:17 am

Re: Differences between airportinfo() and findAirportsByICAO

Postby wkitty42 » Sun Oct 13, 2019 6:38 pm

just different methods of finding same data... of course, there may also be a bug in the findAirportsByICAO routine or in the data for EG69 that would indicate which type of airport it is... i don't know where the data is drawn from, though... possibly from the navcache sql database that FG uses...

i find, in apt.dat.gz, a short 31 line definition for EG69 which seems to indicate it is on "Lundy Island" and the three defined parking places seem to indicate that it is a grass field which you also indicate... without digging into the code that defines findAirportByICAO, i cannot tell what data it is using to determine what kind of airport EG69 is or is not... the documentation in the wiki seems to indicate that only airport, heliport and seaport are searched for and this field may be classified as a "grass field" or similar...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5700
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest