Jump to content
The simFlight Network Forums

Nearest Airport


Recommended Posts

Hi Peter, i have one question a little bit absent of FSUIPC (i think so) - i would like to retrieve the nearest airport from a given location (lat/lon). I think i have to read one or more bgl-files, isn't it? But which ones?

Best Regards

Link to comment
Share on other sites

I think you have 2 options for FS2004:

You can read:

(FS path) \Scenery\ (name, namw, eure, eurw, etc...) \Scenery\AP*.BGL

These contain most, if not all, airports, including the ones that are further detailed in dedicated BGL files like Amsterda.BGL, Paris.BGL, etc... You will need a disassembly tool like Alessandro Antonini's BGLXML to extract the facility data into XML.

Another option is to skip this step and just download the whole airport directory in database format. I encountered it a while ago on Flightsim.com but I don't know the name and I'm not sure if it contains the latitude and longitude of each airport.

In either case, you have to program something to 'find the nearest'.

J.

Link to comment
Share on other sites

i have one question a little bit absent of FSUIPC (i think so) - i would like to retrieve the nearest airport from a given location (lat/lon).

Well, it's never been a function of FSUIPC, nor is it really a natural candidate for one, though it would be nice, if it were merely a matter of asking FS. Maybe there's a way of doing that by calling routines inside FS itself, but I'm afraid I've not found it. I would never consider a facility which would entail FSUIPC scanning files or even looking up a database. That is certainly an application job.

I think i have to read one or more bgl-files, isn't it? But which ones?

Well, I did write a program for FS98/FS2000/FS2002 which built up a complete airport and runway database from a user's scenery installation. It operated by scanning the SCENERY.CFG file and searching ALL of the enabled BGLs for the airport data. Took quite a while, but you only needed to re-run it after changing (installing/deinstalling) scenery.

The database it produced is included in my FStarRC package, and other variations are used in Radar Contact and, I believe, FS-Meteo.

Unfortunately, the formats are all changed in FS2004 and I've not yet had time to investigate, let alone re-write the program.

I suspect that most of the data you need is in the AFD files, not just any old BGL, but even they can be spread around. And I don't think they have to be in their own file. It is quite possible, I think, for an add-on scenery designer to make one BGL with all the bits in it including this data.

I also think that the "SCENERY.DAT files inserted into the scenery owner folders, may contain the results of FS's own scan and probably give a short-cut way into the data. There again, the format changed between FS2002 and FS2004 I think, but I don't know either of them in any case.

I know there are already a number of programs around which do need and use airport data from FS's installed BGLs, so someone should be able to help you further should you need it.

Regards,

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.