/airports

Project to collect airport information

Primary LanguagePython

Grab FAA airport information and store in a back end and make data available via RESTful endpoints.

This project is implemented in Python and Django (including the Django REST Framework).

Possible Future enhancements:

Use a Spatial database (e.g. PostgreSQL with the PostGIS extension, or SQLite with the SpatiaLite extension for local development)

Use the GeoDjango extension https://docs.djangoproject.com/en/1.10/ref/contrib/gis/tutorial/

Setup

It is recommended to use a Python virtualenv (or equivalent) to manage Python dependencies for this project.

sudo pip install virtualenv
sudo pip install virtualenvwrapper

Create the virtual environment and activate it.

virtualenv venv
source venv/bin/activate

Install the Python dependencies for this project.

pip install -r requirements.txt

Change to the "aeroproject" Django site/project directory, and run the database migrations. By default, this will create a SQLite database, and install your schema objects (tables).

cd aeroproject
python manage.py migrate

Loading Data

This project implements Django management commands to load FAA Facilities (Airports) and Runway data.

Files can be downloaded from the FAA website. Location is subject to change (and has), but you would be looking for "Excel" files (tab separated text actually, but called xls). You're eventually looking for an NFDCFacilities and an NDFCRunways file.

https://www.faa.gov/air_traffic/flight_info/aeronav/aero_data/

Latest place I've found them is drilling down from here: https://www.faa.gov/air_traffic/flight_info/aeronav/aero_data/NASR_Subscription/

Once you finally locate the files, load them as follows:

python manage.py load_facilities --file=<downloaded facilities file>
python manage.py load_runways --file=<downloaded runways file>

Running

Activate the virtual environment.

source venv/bin/activate

Change to the "aeroproject" Django site/project directory, and run the server.

python manage.py runserver

Examples

In the following examples, change "localhost:8000" to whatever if you are not running locally with default port.

Test that the backend is working

http://localhost:8000/airports/test/

List of airports

http://localhost:8000/airports/facilities/

Find an airport by code

http://localhost:8000/airports/facility/<code>/

e.g.:

http://localhost:8000/airports/facility/SFO/