As Pete already said, the answer is "no" but ...
Recipe:
- text file with "central spot" coordinates for all airports in the world, one airport per line, like this:
LPPT;LISBOA;38.781311;-9.135919;374
EGLL;HEATHROW;51.4775;-0.461389;83
LFPG;CHARLES DE GAULLE;49.012778;2.55;392
(...)
Note: I believe there is a way to generate it from FS itself...
- The following bit of (ugly) VB code
- A lot of patience to tweak it to your needs ...
Sub mylocation(ByVal curlat As Double, ByVal curlon As Double)
Dim path As String = airportdata 'Full path including filename to the airport coordinates file, like C:\myairport.txt
Dim latdif As Double = 10000
Dim londif As Double = 10000
' Open the stream and read it back.
Dim sr As StreamReader = File.OpenText(path)
Do While sr.Peek()
Dim somatemp As Double = 0
Dim Alat As Double
Dim Blon As Double
Dim temp As String = sr.ReadLine()
Dim TestArray() As String = Split(temp, ";")
If TestArray(0) = "" Then Exit Do
Alat = Val(TestArray(2))
Blon = Val(TestArray(3))
If (Math.Abs(Alat - curlat) < latdif) And (Math.Abs(Blon - curlon) < londif) Then
latdif = Math.Abs(Alat - curlat)
londif = Math.Abs(Blon - curlon)
arpt = TestArray(0)
End If
Loop
sr.Close()
End Sub
When calling mylocation(curFSlat,curFSlon), it *should* set the "arpt" variable to the current airport ICAO.
Be advised that if you're just *near* the airport (and not *at* the airport) it will still set the "arpt" to the nearest airport ICAO ...
Of course you can tweak this: after finding the nearest airport, you can check if the altitude AGL is the same (give or take some feet) as the TestArray(4) - airport elevation- and/or check if the distance from the current location to the airport known location is less or equal than "X" nautical miles ...
Yeah, it *still* can fail, but heybetter than nothing :)
P.S. - If you tweak the code, share it ;-)
Regards,