Wednesday, 21 November 2018

PostGIS database for storing FAA Digital Obstacle File

FAA - Federal Aviation Administration - United States authority to regulate civil aviation issues DOF (Digital Obstacle File) with obstacles of interest to aviation users in the United States, with limited coverage of selected region and countries.

To get more information about DOF and to download data visit:
FAA Digital Obstacle File web page
To understand format of data refer to:
DOF description

If you download a DOF.dat (main file with all records) you will see that file contains information about 450 000 obstacles. This might be pretty impressive number of records, which will be more efficient to use (select large amount of data) in database. Needless to say each obstacle has information about its location. Using of PostGIS - spatial extension for PostgreSQL will be a good choice to deal with this content.

-- Country and state names
CREATE TABLE ctry_state (
 oas_code char(2) PRIMARY KEY,
 cs_name  varchar(100) NOT NULL UNIQUE
);

-- Obstruction verification status
CREATE TABLE verif_stat (
 vs_code char(1) PRIMARY KEY,
 vs_desc varchar(10) NOT NULL UNIQUE
);

-- Type of lighting
CREATE TABLE lighting (
 light_code char(1) PRIMARY KEY,
 light_desc varchar(50) NOT NULL UNIQUE
);

-- Type of marking
CREATE TABLE marking (
 mark_code char(1) PRIMARY KEY,
 mark_desc varchar(50) NOT NULL UNIQUE
);

-- Vertical accuracy
CREATE TABLE vacc (
 vacc_code char(1) PRIMARY KEY,
 vacc_tol  varchar(10) NOT NULL,
 vacc_uom  varchar(10) NOT NULL
);

-- Horizontal accuracy
CREATE TABLE hacc (
 hacc_code char(1) PRIMARY KEY,
 hacc_tol  float NOT NULL,
 hacc_uom  varchar(10) NOT NULL
);

-- Obstruction data, points WGS84
CREATE TABLE obstruction (
 rec_id serial PRIMARY KEY,
 oas_code char(2) NOT NULL REFERENCES ctry_state,
 obs_number char(11) NOT NULL,
 vs_code char(1) NOT NULL REFERENCES verif_stat,
 city_name varchar(20) NULL,
 lat_dms char(12) NOT NULL,
 lon_dms char(13) NOT NULL,
 obs_type varchar(20) NOT NULL,
 agl_height float NULL CONSTRAINT check_agl_height_valid_range CHECK (agl_height >= 0 AND agl_height <= 30000),
 amsl_height float NOT NULL CONSTRAINT check_amsl_height_valid_range CHECK (amsl_height >= -10000 AND amsl_height <= 50000),
 lighting_code char(1) NOT NULL REFERENCES lighting,
 h_acc_code char(1) NOT NULL REFERENCES hacc,
 v_acc_code char(1) NOT NULL REFERENCES vacc,
 marking_code char(1) NOT NULL REFERENCES marking,
 last_update timestamp NOT NULL DEFAULT CLOCK_TIMESTAMP(),
 geo_location geography(POINT, 4326)
);

Script to create tables: https://github.com/strpaw/PostGIS_FAA_DOF_database/blob/master/faa_dof_postgis_db_DDL.sql

No comments:

Post a Comment