1. Another pre-processor use
- Posted by jeremy (admin) Aug 27, 2009
- 1338 views
I just gained access to the FAA data downloads for navigation, airport and airspace definitions across the United States. It contains about 520mb of fixed width files in about 45 different formats. I thought it was going to be a pain to deal with all these different formats, writing specs for them all. Well, as it turns out, the layout specification the FAA gave is in a text file, but the text file is easily parsed. So, I created a pre-processor that reads the FAA layout specification directly and returns a parser for that fixed width data. The pre-processor that does this is 52 lines of Euphoria code. So, in the end, all I do is:
include faa/airport.lay as airport include faa/nav.lay as navigation sequence data = airport:parse("airport.txt") -- use the data
I instantly have access to all 45 layouts, all with 52 lines in a Euphoria pre-processor. I think that's pretty cool!
For those of you who want to know, the .lay files look something like:
L AN 0011 00004 DLID LANDING FACILITY SITE NUMBER THE UNIQUE IDENTIFYING NUMBER OF THE AIRPORT WHOSE RUNWAY IS BEING DESCRIBED. TOGETHER WITH THE RUNWAY ID FIELD, THIS PROVIDES THE UNIQUE KEY TO A RUNWAY RECORD. L AN 0002 00015 DLID RUNWAY STATE POST OFFICE CODE THE STATE WHERE THE LANDING FACILITY IS LOCATED. THIS WAS USED IN SORTING THE ENTIRE FILE BY STATE AND SITE NUMBER. L AN 0007 00017 A30 RUNWAY IDENTIFICATION EX. 01/19; 18L/36R (PARALLEL RUNWAYS); H1 (HELIPAD); N/S (NORTH/SOUTH); ALL/WAY (SEALANE); B1 (BALLOONPORT) ----------------------------------------------- COMMON RUNWAY DATA ----------------------------------------------- R AN 0005 00024 A31 PHYSICAL RUNWAY LENGTH (NEAREST FOOT) (EX. 3500) R AN 0004 00029 A32 PHYSICAL RUNWAY WIDTH (NEAREST FOOT) (EX. 100)
As you can see, I simply need to look at column 1 to determine if it's a data line (Right or Left justified). I then verify by checking to see if the next 2 characters are a valid type field, if so, I then parse the rest of that line to generate the fixed width parser.
Anyway, just sharing some things that are/have been done with the pre-processor already.
Jeremy
2. Re: Another pre-processor use
- Posted by useless Aug 27, 2009
- 1292 views
I just gained access to the FAA data downloads for navigation, airport and airspace definitions across the United States. It contains about 520mb of fixed width files in about 45 different formats. I thought it was going to be a pain to deal with all these different formats, writing specs for them all. Well, as it turns out, the layout specification the FAA gave is in a text file, but the text file is easily parsed. So, I created a pre-processor that reads the FAA layout specification directly and returns a parser for that fixed width data. The pre-processor that does this is 52 lines of Euphoria code. So, in the end, all I do is:
include faa/airport.lay as airport include faa/nav.lay as navigation sequence data = airport:parse("airport.txt") -- use the data
I instantly have access to all 45 layouts, all with 52 lines in a Euphoria pre-processor. I think that's pretty cool!
For those of you who want to know, the .lay files look something like:
L AN 0011 00004 DLID LANDING FACILITY SITE NUMBER THE UNIQUE IDENTIFYING NUMBER OF THE AIRPORT WHOSE RUNWAY IS BEING DESCRIBED. TOGETHER WITH THE RUNWAY ID FIELD, THIS PROVIDES THE UNIQUE KEY TO A RUNWAY RECORD. L AN 0002 00015 DLID RUNWAY STATE POST OFFICE CODE THE STATE WHERE THE LANDING FACILITY IS LOCATED. THIS WAS USED IN SORTING THE ENTIRE FILE BY STATE AND SITE NUMBER. L AN 0007 00017 A30 RUNWAY IDENTIFICATION EX. 01/19; 18L/36R (PARALLEL RUNWAYS); H1 (HELIPAD); N/S (NORTH/SOUTH); ALL/WAY (SEALANE); B1 (BALLOONPORT) ----------------------------------------------- COMMON RUNWAY DATA ----------------------------------------------- R AN 0005 00024 A31 PHYSICAL RUNWAY LENGTH (NEAREST FOOT) (EX. 3500) R AN 0004 00029 A32 PHYSICAL RUNWAY WIDTH (NEAREST FOOT) (EX. 100)
As you can see, I simply need to look at column 1 to determine if it's a data line (Right or Left justified). I then verify by checking to see if the next 2 characters are a valid type field, if so, I then parse the rest of that line to generate the fixed width parser.
Anyway, just sharing some things that are/have been done with the pre-processor already.
Jeremy
That is cool. Praps i can do the same with the world-wide airport data Tiggr has. That data has additional parameters, like available services, tower languages spoken (not just french and english), etc, like the oceanic port of call data.
useless
3. Re: Another pre-processor use
- Posted by jeremy (admin) Aug 27, 2009
- 1289 views
That is cool. Praps i can do the same with the world-wide airport data Tiggr has. That data has additional parameters, like available services, tower languages spoken (not just french and english), etc, like the oceanic port of call data.
Where did you get the world wide data? This data I have is what is actually put into making sectional charts and aircraft facility directories, but it contains only US (and some Canadian airports). It does not contain language, as to fly in the United States you have to be able to read/write/speak English. If you cannot, you cannot fly an aircraft in the US.
Jeremy
4. Re: Another pre-processor use
- Posted by jeremy (admin) Aug 27, 2009
- 1344 views
That is cool. Praps i can do the same with the world-wide airport data Tiggr has. That data has additional parameters, like available services, tower languages spoken (not just french and english), etc, like the oceanic port of call data.
Here is a commercial service providing access to the FAA data that I downloaded (it's avail for free, but people publish it in usable fashions)... For instance, 15G... This is my home airport: http://www.airnav.com/airport/15G
Jeremy
5. Re: Another pre-processor use
- Posted by useless Aug 27, 2009
- 1329 views
That is cool. Praps i can do the same with the world-wide airport data Tiggr has. That data has additional parameters, like available services, tower languages spoken (not just french and english), etc, like the oceanic port of call data.
Where did you get the world wide data? This data I have is what is actually put into making sectional charts and aircraft facility directories, but it contains only US (and some Canadian airports). It does not contain language, as to fly in the United States you have to be able to read/write/speak English. If you cannot, you cannot fly an aircraft in the US.
Jeremy
I don't remember where i got the global airport data, but i feel we had this discussion before. The data is on the win95 drives, which are no longer on this computer, so i cannot look it up now. However, the ocean port data is on this computer, and not lost in The Great Drive Fiasco. A pic of the pdf form data is at http://imgbin.org/index.php?page=image&id=713 and i do not remember where i got it either. Sometimes i just let Tiggr roam.
useless