So I got bored a couple weeks back and started playing with various FAA data products to see what I could do with them. Mostly, I haven’t programmed in a while and wanted something interesting to do.
I parsed through parts of the National Flight Data Center information. I ended up with a database containing 19,506 airports, 2,564 navigation aids, and 66,725 airspace fixes. The data set has definitions for the airways and arrival/departure procedures as well, but I’m holding off on parsing that until I get something more basic working. I’ll try and write up more on the parse scripts if I get a chance, but they were pretty straightforward.
I’ve got a test map up to prove to myself that I can get data out of the database and onto a map layer. Right now, I’m just showing public airports to limit the data set, and I’m using a VORTAC icon for them because it was what I had handy, but I’m always entertained to see something come together.
Anyway, once I got basic data connections working and a set of data in the database, I decided to see what I could do about the map. The FAA now has nice GeoTIFF sectional charts available for download, so I grabbed a few to see what I could do.
I went with Leaflet for my map engine, as it seems pretty flexible and easy to use. I was attempting to use TileMill to convert the GeoTIFFs to map tiles, but TileMill does not appear to like non-Mercator projections for source files. The sectionals are Lambert Conformal Conic.
Ideally, I’d like to automate the process so that I can keep the map up to date without too much work. I’m not there yet, but I think I may have a way to do it in the future. That led me to look at GDAL. Not necessarily user friendly, but I should be able to hack together a Python script or even a batch file to run the needed commands. The only problem is, the GeoTIFF files for each sectional include the legend, and the map area border isn’t in the same place for each sectional, so I can’t just mask a set area as I mosaic the maps together.
I ended up with something that worked using QGIS. I loaded up my maps and got tons of awesome overlap, as expected:
I found a nice tutorial on clipping a raster using a shapefile. I figured that at least for a proof of concept, I could try manually mask a few files and see if it works. So, for each of the three maps shown above, I defined a mask:
When I used QGIS’s Clipper tool, I ended up with something like this:
Much better. There is some very slight misalignment at the seams, but I’d say it’s pretty good for an evening’s work. Also, as QGIS is just calling gdal_translate to do the cut operation (and even tells you what the command/options are in the Clipper tool), once I define shapefiles for the map area of each sectional, I should be able to write a script to automate the process using GDAL directly instead of manually using QGIS.
Now just 51 more sectionals to make shapefiles for!