This directory contains the "faaairports" program that parses the U.S. FAA
airports data base, as available in textual format from

    https://nfdc.faa.gov/xwiki/bin/view/NFDC

and generate a valid ACM scenery file for each given range of latitude and
longitude.

Some Bash scripts are also included to create the basic sceneries included in
the distributed package.


Syntax of the command
=====================
Lline continuation char '\' added for readability:

	faaairports.exe \
			--lat-min LAT_MIN \
			--lat-max LAT_MAX \
			--lon-min LON_MIN \
			--lon-max LON_MAX \
			--src-dir DIR_FAA_DB

where:

	LAT_MIN, LAT_MAX, LON_MIN, LON_MAX is the range of latitude and longiture
	of the items to extract (more about this next). The syntax is that usual,
	examples:   10.5N   10-30N   10-30-00.000N   96W    etc.

	DIR_FAA_DB is the directory containing the FAA data base in its textual
	format. The following files are read from that directory: APT.txt,
	ILS.txt, NAV.txt.

The resulting ACM scenery file is written on standard output, while errors are
sent to standard error.


Features
========

An item located at (lat,lon) is included in the generated output only if lies in
the indicated range of latitude and longitude, that is:

	LAT_MIN <= lat < LAT_MAX   and
    LON_MIN <= lon < LON_MAX

Note that there is no way to include an item if it is located exactly at the
north pole; this does not seem to be a severe limitation, though.
Items located exactly on the 180E meridian are excluded too, but it seems
there are not items there in the U.S. FAA data base.

VOR and NDB are included if their location is in the range; the possible DME, if
any, does not matter as under ACM the location of this latter must coincide with
its respective VOR or NDB antenna.

ILS are included based on the location of the LOCATOR antenna only; the locations
of the associate GS and DME attennas do not matter.

Runways are included if their middle point lies in the range.

For runways very close to the edges of the zone it may happen some related ILS be
missing from the resulting scenery because it falls outside the zone; this is not
a problem for acm.exe because nearby zones are loaded (if available!), but it is
a problem for the chart program which can "see" only one scenery at a time.


Issues
======

Precise ILS bearing determination.
----------------------------------
For each ILS, its magnetic bearing MH is provided with a very hight accuracy of
0.01 DEG, but the corresponding magnetic deviation VAR is given with only 1 DEG
of precision; the resulting calculated true bearing TH=MH+VAR is then affected
by a quite large error of 1 DEG, which means 32 m of deviation for a runway
1 NM long. To fix this issue and allow the airplane to land closer to the middle
of the runway, the following heuristic applies:

The program also calculates the true bearing TH2 as the bearing of the line
joining the locator to the served runway end position, if available.
If this TH2 differs less than 1 DEG from the nominal TH, the difference is
assumed to be due to the issue above only, and this calculated TH2 overrides
the nominal value TH.
Otherwise, if the calculated TH2 differs more than 1 DEG, the difference cannot
be due to a rounding problem of the VAR, and the nominal TH is kept; a warning
is displayed for precision approaches ILSs. SDF and LDA are assumed non-precision
approaches.


ILS name "I-XXX" silently changed to "IXXX" to comply with ACM requirements.
----------------------------------------------------------------------------


ILSs beams width is mostly missing.
-----------------------------------
If beam width is missing, 5 DEG is silently assumed.


Cope with current ACM ILS record limitations.
---------------------------------------------
In the real world an ILS consists of up to 3 antennas: locator, GS and DME.
Each antenna has its own location (latitude and longitude) and its own
elevation. Unfortunately, the current format of the ACM ILS record allows to
specify the location of the locator and GS and provides only one elevation
field; distance is calculated using locator location + available elevation;
landing point is calculated using GS location + available elevation.
We remedy as follows depending on the type of ILS:

1. LOCATOR only ILS. No problem at all; the elevation field is set with the
   elevation of the locator.

2. LOCATOR + GS. Elevation field is set with the GS elevation for precise
   touch down point simulation; actual locator altitude is usually very close
   and does not care too much anyway.

3. LOCATOR + DME. ACM assumes the DME antenna coincides with the locator,
   which is already a source of error for precise distance measurement;
   to mitigate this, the elevation field is set with the actual DME elevation;
   actual locator altitude is usually very close and does not care too much
   anyway.

4. LOCATOR + GS + DME. Just like LOCATOR + GS for precise touch down point.

Further complication: the elevation field is blank in many cases, so we
take the value available in the following order of preference:
GS, DME, LOCATOR. If no value available at all, zero is assumed and a
warning is displayed.


"VOT" FAA test facility NAVAIDs are not reported.
-------------------------------------------------


- Umberto Salsi
