[net.sources] Aviation Navigation Program and Database

rje@cae780.UUCP (Bob Evans) (12/16/85)

This is the latest version of the Avaiation Navigation program and Database.
To create the program, documentation and database save this message to a file.
Edit the file to delete everything down to and including the line saying
'cut here'. Save the edited file. Change the edited file to an executable
by doing chmod 777 <file_name>. Then execute the file. After the sources
have been extracted, type 'make'. Read the file called 'nav.doc'.


FROM:   Robert J. Evans, CAE Systems Division of Tektronix, Inc.
UUCP:   tektronix!teklds!cae780!rje
	{ihnp4, decvax!decwrl}!amdcad!cae780!rje 
        {nsc, hplabs, resonex, qubix, leadsv}!cae780!rje 
USNAIL: 5302 Betsy Ross Drive, Santa Clara, CA  95054
AT&T:   (408)727-1234 x4819


--------------- cut here -------------------------
: This is a shar archive. Extract with sh, not csh.
: The rest of this file will extract the following
: Makefile, file.c, main.c, nav.c, nav.h, output.c
: scan.c, airports, vors, nav.doc
echo Extracting Makefile ...
sed 's/^X//' >Makefile << '!E_O_F!'
X#
X#	Makefile for "nav" pre-flight great circle program
X#
X
Xall: nav
X
XCFLGS=-O
X
X#
X# "-lnm" refers to a "new math" library.  You might not have it, but "-lm".
X#
Xnav: main.o nav.o file.o scan.o output.o nav.h
X	cc ${CFLGS} main.o nav.o file.o scan.o output.o -o nav -lm
X
Xmain.o: main.c nav.h
X
Xnav.o: nav.c nav.h
X
Xfile.o: file.c nav.h
X
Xscan.o: scan.c nav.h
X
Xoutput.o: output.c
X
Xinstall: nav
X	install -c -s nav /whatever/bin/nav
X
Xclean:
X	-rm -f *.o core
X
Xcleanall:
X	-rm -f *.o core nav
!E_O_F!
echo Extracting file.c ...
sed 's/^X//' >file.c <<'!E_O_F!'
X/*
X *	Routines for reading and parsing nav data files
X *
X *	All degrees stored as decimal degrees.
X */
X#include <stdio.h>
X#include "nav.h"
X
Xdouble Radians();
Xdouble Degrees();
Xchar *index();
Xchar *malloc();
Xdouble atof();
X
Xstruct vor *LineToVor(s)
Xchar *s;
X{
X	static struct vor buf;
X	register char *p, *q;
X	register double min;
X
X	p = s;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	strcpy(buf.id,p);		/* copy in the id */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	strcpy(buf.name,p);		/* copy in the name */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.freq = (float)atof(p);	/* frequency */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.alt = atoi(p);		/* vor altitude in feet */
X	p = q+1;                        /* vortacs must be non-zero */
X	q = index(p,':');               /* vors must be zero */
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.var = atof(p);		/* variation in degrees */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	min = atof(p) / 60;		/* add variation minutes */
X	buf.var += buf.var<0 ? (0. - min) : min;
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.loc.lat.deg = atof(p);	/* north degrees */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	min = atof(p) / 60;		/* add north minutes */
X	buf.loc.lat.deg += buf.loc.lat.deg<0 ? (0. - min) : min;
X	buf.loc.lat.rad = Radians(buf.loc.lat.deg);
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.loc.lon.deg = atof(p);	/* west degrees */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	min = atof(p) / 60;		/* add west minutes */
X	buf.loc.lon.deg += buf.loc.lon.deg<0 ? (0. - min) : min;
X	buf.loc.lon.rad = Radians(buf.loc.lon.deg);
X	p = q+1;
X	if (! *p)
X		return NULL;
X	strncpy(buf.comments,p,sizeof buf.comments);
X	q = index(buf.comments,'\n');
X	q = 0;
X	return &buf;
X}
X
Xstruct apt *LineToApt(s)
Xchar *s;
X{
X	static struct apt buf;
X	register char *p, *q;
X	register double min;
X
X	p = s;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	strcpy(buf.id,p);		/* copy in the id */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	strcpy(buf.city,p);		/* city closest to airport */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	strcpy(buf.name,p);		/* name of airport */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.alt = atoi(p);		/* airport altitude in feet */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.var = atof(p);		/* variation in decimal degrees */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	min = atof(p) / 60;		/* add variation minutes */
X	buf.var += buf.var<0 ? (0. - min) : min;
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.loc.lat.deg = atof(p);	/* north degrees */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	min = atof(p) / 60;		/* add north minutes */
X	buf.loc.lat.deg += buf.loc.lat.deg<0 ? (0. - min) : min;
X	buf.loc.lat.rad = Radians(buf.loc.lat.deg);
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	buf.loc.lon.deg = atof(p);	/* west degrees */
X	p = q+1;
X	q = index(p,':');
X	if (q == NULL)
X		return NULL;
X	*q = 0;
X	min = atof(p) / 60;		/* add west minutes */
X	buf.loc.lon.deg += buf.loc.lon.deg<0 ? (0. - min) : min;
X	buf.loc.lon.rad = Radians(buf.loc.lon.deg);
X	p = q+1;
X	if (! *p)
X		return NULL;
X	strncpy(buf.comments,p,sizeof buf.comments);
X	q = index(buf.comments,'\n');
X	q = 0;
X	return &buf;
X}
X
X/*
X *	Fill array of struct apt with data from file.
X *	Return number of elements in array, 0 on error.
X */
XParseApt(array,fp)
Xstruct apt array[];
XFILE fp;
X{
X	char line[BUFSIZ];
X	register char *s;
X	register struct apt *ptr;
X	register int cnt;
X
X	cnt = 0;
X	while ((cnt <= MAXAPTS) && (fgets(line, sizeof line, fp) != NULL)){
X		if ( line[0] == '#' ){	/* comment line */
X			continue;
X		}
X		ptr = LineToApt(line);
X		if (ptr == NULL){
X			fprintf(stderr,
X			"LineToApt from ParseApt returned NULL on line\n%s\n",
X			line);
X			return NULL;
X		}
X		array[cnt] = *ptr;
X		cnt++;
X	}
X	return cnt;
X}
X
X/*
X *	Fill array of struct vor with data from file.
X *	Return number of elements in array, 0 on error.
X */
XParseVor(array,fp)
Xstruct vor array[];
XFILE fp;
X{
X	char line[BUFSIZ];
X	register char *s;
X	register struct vor *ptr;
X	register int cnt;
X
X	cnt = 0;
X	while ((cnt <= MAXVORS) && (fgets(line, sizeof line, fp) != NULL)){
X		if ( line[0] == '#' ){	/* comment line */
X			continue;
X		}
X		ptr = LineToVor(line);
X		if (ptr == NULL){
X			fprintf(stderr,
X			"LineToVor from ParseVor returned NULL on line\n%s\n",
X			line);
X			return NULL;
X		}
X		array[cnt] = *ptr;
X		cnt++;
X	}
X	return cnt;
X}
!E_O_F!
echo Extracting main.c ...
sed 's/^X//' >main.c <<'!E_O_F!'
X#include <stdio.h>
X#include <math.h>
X#include "nav.h"
X
Xdouble Distance();
Xdouble Bearing();
Xdouble Magnetic();
Xdouble Degrees();
Xdouble Radians();
Xdouble LatIntercept();
X
Xint comflg;
Xint rviaflg;
Xint altflg;
Xint windflg;
Xint speedflg;
X
Xmain(ac,av)
Xint ac;
Xchar **av;
X{
X	struct apt AptArray[MAXAPTS];
X	struct vor VorArray[MAXVORS];
X	struct vor ViaArray[MAXVIA];
X        int AltArray[MAXVORS];
X        int WindArray[MAXVORS*2];
X        int SpeedArray[MAXVORS];
X	int AltC, AptC, SpeedC, VorC, ViaC, WindC;
X	FILE *fpa, *fpv;
X	struct apt From, To;
X	double Dist, TotalDist, Course, WpLat, WpDist, WpRad;
X        double A, B, C, WpLon;
X        int AltDiff;
X	char sysbuf[BUFSIZ];
X
X	struct fix LastFix;
X	double LastVar;
X	char LastId[NAMLEN];
X
X	register int v;
X	register int i;
X	int  fromflg, toflg, viaflg;
X
X	comflg = 0;
X	fromflg = 0;
X	toflg = 0;
X	viaflg = 0;
X	rviaflg = 0;
X        altflg = 0;
X        windflg = 0;
X        speedflg = 0;
X
X	fpa = fopen(AIRPORTS,"r");
X	if (fpa == NULL){
X		perror(AIRPORTS);
X		exit(1);
X	}
X	fpv = fopen(VORS,"r");
X	if (fpv == NULL){
X		perror(VORS);
X		exit(1);
X	}
X	AptC = ParseApt(AptArray,fpa);
X	if (! AptC){
X		oops("Trouble parsing airports");
X	}
X	fclose(fpa);
X	VorC = ParseVor(VorArray,fpv);
X	if (! VorC){
X		oops("Trouble parsing VORs");
X	}
X	fclose(fpv);
X
X	ac--;av++;
X	while(ac){
X		if (strcmp(*av,"-from") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("from: Missing departure ID");
X			if (fromflg)
X				usage("from: Two departure points?");
X			if (FindApt(&From,*av,AptArray,AptC) != 0)
X				oops("Couldn't find your departure airport");
X			fromflg++;
X			ac--;av++;
X		}else if (strcmp(*av,"-to") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("to: Missing destination ID");
X			if (toflg)
X				usage("to: Two destinations?");
X			if (FindApt(&To,*av,AptArray,AptC) != 0)
X				oops("Couldn't find your destination airport");
X			toflg++;
X			ac--;av++;
X		}else if (strcmp(*av,"-via") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("via: Missing VOR ID(s)");
X			if (viaflg)
X				usage("via: One set of 'via' VORs please");
X			for(ViaC=0;
X			ac && (**av != '-') && (ViaC < MAXVIA);
X			ViaC++){
X				if (FindVor(&ViaArray[ViaC],*av,VorArray,VorC)
X				!= 0){
X					fprintf(stderr,
X						"via: %s: VOR not found\n",*av);
X					exit(1);
X				}
X				ac--;av++;
X			}
X			viaflg++;
X		}else if (strcmp(*av,"-rvia") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("rvia: Missing VOR ID(s)");
X			if (rviaflg)
X				usage("rvia: One set of 'rvia' VORs please");
X			for(ViaC=0;
X			ac && (**av != '-') && (ViaC < MAXVIA);
X			ViaC++){
X				if (FindVor(&ViaArray[ViaC],*av,VorArray,VorC)
X				!= 0){
X					fprintf(stderr,
X						"rvia: %s: VOR not found\n",*av);
X					exit(1);
X				}
X				ac--;av++;
X			}
X			rviaflg++;
X		}else if (strcmp(*av,"-alt") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("alt: Missing ALTITUDE ");
X			if (altflg)
X				usage("alt: One set of ALTITUDEs please");
X			for(AltC=0;
X			ac && (**av != '-') && (AltC < MAXVIA);
X			AltC++){
X				if (StoreAlt(AltArray,AltC,*av)
X				!= 0){
X					fprintf(stderr,
X						"alt: Altitude not found\n",*av);
X					exit(1);
X				}
X				ac--;av++;
X			}
X			altflg++;
X		}else if (strcmp(*av,"-wind") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("wind: Missing WINDS ALOFT ");
X			if (windflg)
X				usage("wind: One set of WINDS ALOFT please");
X			for(WindC=0;
X			ac && (**av != '-') && (WindC < MAXVIA);
X			WindC=WindC+2){
X				if (StoreWind(WindArray,&WindC,*av)
X				!= 0){
X					fprintf(stderr,
X						"wind: WINDS ALOFT error\n",*av);
X					exit(1);
X				}
X				ac--;av++;
X			}
X			windflg++;
X		}else if (strcmp(*av,"-speed") == 0){
X			ac--;av++;
X			if(!ac || **av == '-')
X				usage("speed: Missing AIRSPEED ");
X			if (speedflg)
X				usage("speed: One set of AIRSPEEDs please");
X			for(SpeedC=0;
X			ac && (**av != '-') && (SpeedC < MAXVIA);
X			SpeedC++){
X				if (StoreSpeed(SpeedArray,SpeedC,*av)
X				!= 0){
X					fprintf(stderr,
X						"speed: AIRSPEED not found\n",*av);
X					exit(1);
X				}
X				ac--;av++;
X			}
X			speedflg++;
X		}else if (strcmp(*av,"-com") == 0){
X			comflg++;
X			ac--;av++;
X		}else if (strcmp(*av,"-airports") == 0){
X			sprintf(sysbuf,"/usr/ucb/more %s",AIRPORTS);
X			system(sysbuf);
X			exit(0);
X		}else if (strcmp(*av,"-vors") == 0){
X			sprintf(sysbuf,"/usr/ucb/more %s",VORS);
X			system(sysbuf);
X			exit(0);
X		}else if (strcmp(*av,"-k") == 0){
X			ac--;av++;
X			if (!ac) usage("-k: missing keyword or pattern");
X			sprintf(sysbuf,"/bin/grep -i %s %s",
X				*av,AIRPORTS);
X			system(sysbuf);
X			sprintf(sysbuf,"/bin/grep -i %s %s",
X				*av,VORS);
X			system(sysbuf);
X			exit(0);
X		}
X		else
X/*
X *	Default action here
X */
X			usage("Plan a flight...");
X	}
X
X	if	( (fromflg && !(toflg || viaflg))	||
X		  ( toflg && !(fromflg || viaflg))	||
X		  (viaflg && rviaflg)			||
X		  (rviaflg && !(fromflg && toflg))	||
X                  (windflg && !(speedflg))	        ||
X		  ((!fromflg && !toflg) && !viaflg) )
X		usage("Plan a flight...");
X/*
X *	Now that we are done loading the data into the structs
X *	and parsing the command line, we can have some fun.
X */
X
X	TotalDist = Dist = 0.;
X	if(fromflg){
X		LastFix = From.loc;
X		LastVar = From.var;
X		strcpy(LastId,From.id);
X	}
X	if (rviaflg) {
X	   viaflg = rviaflg;
X	   for (v=0; v < ViaC; v++) 
X              if (ViaArray[v].alt != 0) {
X           
X                /* Compute a point that lies on the Great Circle Route
X                   at the same longitude as the vor that we are using
X                */
X			WpLat =
X			   LatIntercept(From.loc.lat.rad, From.loc.lon.rad,
X					To.loc.lat.rad, To.loc.lon.rad,
X					ViaArray[v].loc.lon.rad);
X
X                /* Compute the slope of the line from From to the
X                    point that is on the Great Circle Route
X                */
X                        B = ViaArray [v].loc.lon.rad - From.loc.lon.rad;
X                        A = -(WpLat - From.loc.lat.rad);
X                        C = -((A*From.loc.lon.rad)+(B*From.loc.lat.rad));
X
X                /* Compute the coordinates of a point on the Great
X                    Circle Route that is perpendicular to the VOR
X                */
X                        WpLon = (((B*B)*ViaArray[v].loc.lon.rad) -
X                                 (A*B*ViaArray[v].loc.lat.rad) - A*C) /
X                                 ((A*A)+(B*B));
X                        WpLat = -(((A*B*ViaArray[v].loc.lon.rad) -
X                                   ((A*A)*ViaArray[v].loc.lat.rad) + B*C) /
X                                   ((A*A)+(B*B)));
X
X                 /* Compute the distance from the VOR to the point
X                     that lies on the Great Circle Route
X                 */
X                        WpDist = Distance (ViaArray[v].loc.lat.rad,
X                                           ViaArray[v].loc.lon.rad,
X                                           WpLat, WpLon);
X                        if (altflg) {
X                            AltDiff = abs(ViaArray[v].alt - AltArray[v]);
X                            AltDiff = AltDiff / (5280 * 1.15);
X                            WpDist = sqrt((WpDist*WpDist) +
X                                          (AltDiff*AltDiff));
X                        }
X                 /* Finally, compute the bearing from the VOR to
X                     the point that will be our WayPoint.
X                 */
X                        WpRad  = Bearing (From.loc.lat.rad,
X                                          From.loc.lon.rad,
X                                          To.loc.lat.rad,
X                                          To.loc.lon.rad) - 90.;
X                        if (WpRad < 0.) WpRad = WpRad + 360.;
X                        if (WpLon < ViaArray[v].loc.lon.rad) 
X                            WpRad = WpRad+180.;
X                        WpRad  = Magnetic (WpRad, ViaArray[v].var);
X
X			ViaArray[v].loc.lat.rad = WpLat;
X			ViaArray[v].loc.lat.deg = Degrees(WpLat);
X                        ViaArray[v].loc.lon.rad = WpLon;
X                        ViaArray[v].loc.lon.deg = Degrees(WpLon);
X                        ViaArray[v].loc.radial  = WpRad;
X                        ViaArray[v].loc.nm      = WpDist;  
X			sprintf(ViaArray[v].waypoint,
X				"%s R-%05.1f / %.1f",
X				ViaArray[v].id, WpRad, WpDist);
X			sprintf(ViaArray[v].id,
X				"WP%d",
X				v+1);
X    	    }
X	}
X	if (viaflg){
X		v=0;
X		if (!fromflg){
X			LastFix = ViaArray[v].loc;
X			LastVar = ViaArray[v].var;
X			strcpy(LastId,ViaArray[v].id);
X			v++;
X		}else{
X			Dist = Distance(LastFix.lat.rad,LastFix.lon.rad,
X			    ViaArray[v].loc.lat.rad,ViaArray[v].loc.lon.rad);
X			Course= Bearing(LastFix.lat.rad,LastFix.lon.rad,
X			    ViaArray[v].loc.lat.rad,ViaArray[v].loc.lon.rad);
X			TotalDist += Dist;
X			LastFix = ViaArray[v].loc;
X			LastVar = ViaArray[v].var;
X			strcpy(LastId,ViaArray[v].id);
X			v++;
X		}
X
X	}
X
X   for (v = 0; v <= ViaC; v++)
X   {
X       if (speedflg)
X          if (SpeedArray[v] == 0)
X             if (v > 0)
X                SpeedArray[v] = SpeedArray[v-1];
X       if (altflg)
X          if (AltArray[v] == 0)
X             if (v > 0)
X                AltArray[v] = AltArray[v-1];
X       if (windflg)
X          if (WindArray[v*2] == 0)
X             if (v > 0)
X             {
X                WindArray[v*2] = WindArray[(v-1)*2];
X                WindArray[v*2+1] = WindArray[(v-1)*2+1];
X             }
X   }
X   FlightGuide (&From, &To,
X                fromflg, toflg,
X                altflg, AltArray, 
X                speedflg, SpeedArray,
X                windflg, WindArray,
X                viaflg, rviaflg, ViaC, ViaArray);
X   
X
X}
X
Xusage(s)
Xchar *s;
X{
X	fprintf(stderr,"nav: %s\n\n",s);
X	fprintf(stderr,
X	"Usage: nav [-from airport_id -to airport_id] [-[r]via vor [vor...]] [-com]\n");
X	fprintf(stderr,
X	"(The order of the 'from', 'to' and '[r]via' parts may be arbitrary)\n");
X	fprintf(stderr,
X	"Or:\nnav -k string: grep a string from the databases ignoring case\n");
X	fprintf(stderr,
X	"nav -airports : print out the airport database\n");
X	fprintf(stderr,
X	"nav -vors : print out the vor database\n");
X	fprintf(stderr,"\nUse the abbreviated IDs found in the databases.\n");
X	exit(1);
X}
X
Xoops(s)
Xchar *s;
X{
X	fprintf(stderr,"nav: %s\n",s);
X	exit(1);
X}
!E_O_F!
echo Extracting nav.c ...
sed 's/^X//' >nav.c <<'!E_O_F!'
X#include <math.h>
X#include "nav.h"
X/*
X * Corrected Magnetic procedure for course < 0     09-24-85
X *
X */
X/*
X *	Returns radians given decimal degrees
X */
Xdouble Radians(degrees)
Xdouble degrees;
X{
X	return degrees * (pi/180.);
X}
X
X/*
X *	Returns decimal degrees given radians
X */
Xdouble Degrees(radians)
Xdouble radians;
X{
X	return radians / (pi/180.);
X}
X
X/*
X *	Returns distance in Nautical Miles given two sets of latitude
X *	and longitude in radians.
X *	Latitudes are positive for North, negative for South (N1, N2)
X *	Longitudes are positive for West, negative for East  (W1, W2)
X *
X *	Algorithm from HP-25 Applications Programs, Rhumbline Navigation,
X *	page 65.
X */
Xdouble Distance(N1,W1,N2,W2)
Xdouble N1,W1,N2,W2;
X{
X	register double C;
X
X	C = atan2 (
X	    ( 2. * asin(sin(.5 * (W1 - W2))) )
X		,
X	    ( log(tan(pi*.25 + .5*N2)) - log(tan(pi*.25 + .5*N1)) )
X		 );
X
X	if (N1 == N2)
X	      return (60. * fabs(Degrees(2. * asin(sin(.5 * (W1 - W2)))))
X			  * cos(N1));
X	   else
X	      return (60. * Degrees(N2 - N1) / cos(fabs(C)));
X} 
X
X/*
X *	Returns true bearing from North in decimal degrees given two sets of
X *	latitude and longitude in radians.
X *	Latitudes are positive for North, negative for South (N1, N2)
X *	Longitudes are positive for West, negative for East  (W1, W2)
X *
X *	Algorithm from HP-25 Applications Programs, Rhumbline Navigation,
X *	page 65.
X */
Xdouble Bearing(N1,W1,N2,W2)
Xdouble N1,W1,N2,W2;
X{
X	register double C;
X
X	C = atan2 (
X	    ( 2. * asin(sin(.5 * (W1 - W2))) )
X		,
X	    ( log(tan(pi*.25 + .5*N2)) - log(tan(pi*.25 + .5*N1)) )
X		 );
X	return ( (asin(sin(W1-W2)) >= 0.)
X			? Degrees(fabs(C))
X			: 360. - Degrees(fabs(C)) );
X
X
X}
X
X/*
X *	Returns magnetic bearing in decimal degrees given true bearing and the
X *	magnetic variation in decimal degrees.  East variation is expressed
X *	by a negative value.	Pretty fancy, eh?
X */
Xdouble Magnetic(true,variation)
Xdouble true,variation;
X{
X	register double course;
X
X	course = true + variation;
X	if ( course < 0. ) course = 360. + course;
X	if ( course >= 360. ) course = course - 360.;
X	return course;
X}
X
X/*
X *	Returns latitude in radians (Ni) of the intercept at longitude
X *	Wi for the great circle course from (N1, W1) to (N2, W2).
X *	Latitude and longitude in radians.
X *	Latitudes are positive for North, negative for South (N1, N2)
X *	Longitudes are positive for West, negative for East  (W1, W2)
X *
X *	Algorithm from HP-25 Applications Programs, Great Circle Ploting,
X *	page 62.
X */
Xdouble LatIntercept(N1,W1,N2,W2,Wi)
Xdouble N1,W1,N2,W2,Wi;
X{
X	if (W1 == W2)
X		oops("Sorry, True N/S from/to's break nav");
X
X	return (
X		atan(
X		     (tan(N2)*sin(Wi-W1) - tan(N1)*sin(Wi-W2))
X				/
X		     (sin(W2-W1))
X		)
X	);
X}
XWindCorrection (tas, crs, speed, direction, gs, var)
Xint tas, speed, direction, *gs;
Xdouble *crs, var;
X{
Xdouble B, wca;
X
X	if (*crs == direction) /* heading is INTO the wind */
X        {
X            *gs = *gs - speed;
X        }
X        else
X        if (((abs(*crs - direction)) % 180) == 0) /* heading WITH the wind */
X        {
X            *gs = *gs + speed;
X        }
X        else /* compute effect of wind on heading and ground speed */
X        {
X            B = Radians (*crs - (direction+var));
X            *gs = sqrt (tas*tas + speed*speed -  2.*tas*speed*cos(B));
X            wca = Degrees(asin (speed / (*gs / sin(B))));
X            *crs = *crs - wca;
X            if (*crs < 0) *crs = *crs + 360.0;
X        }
X}
X
!E_O_F!
echo Extracting nav.doc ...
sed 's/^X//' >nav.doc <<'!E_O_F!'
X                Aviation Navigation Program and Database
X
X
XThis program will compute the rhumbline equivalent of a great circle
Xroute between two points. The program uses two databases - one contains
Xinformation on airports, the other contains information about VORs and
XVORTACS. The program will compute either an RNAV course from waypoint to
Xwaypoint or will plot a course from VOR to VOR. In the RNAV mode any VORs 
Xgiven (as opposed to VORTACS) will be used as the waypoint.
X
XThe output of the program consists of a Flight Guide that gives True and
XMagnetic course, From - To pairs, VOR[TAC] frequency, radial and distance
Xfor RNAV, leg distance and total distance, and leg time and elapsed time. 
XIf the program is given the aircraft altitude and true airspeed the output 
Xwill include true slant range rather than distance from the VORTAC for 
XRNAV and duration for each leg and for the total flight.
X
XThe airports and vors files are ASCII text files. The format for each
Xfile is given at the head of each file. You may add airports or vors
Xand vortacs to the files. The current files include coverage for 
XCalifornia, Oregon and Nevada.
X
XThe program is created by invoking "make". After the make is completed
Xthe executable file "nav" will exist. The program has several options -
X
X  -from <id>            the <id> of the airport the flight starts from.
X  -to <id>              the <id> of the airport the flight terminates at.
X  -via <id>..<id>       the <id>s of the VORs to use for navigation. 
X                        Use either -via or -rvia, not both.
X  -rvia <id>..<id>      the <id>s of VORTACs to use for RNAV. If an <id>
X                        is not a VORTAC, the waypoint will be over the VOR.
X                        Use either -rvia or -via, not both.
X  -alt <feet>..<feet>   the altitude in feet for each leg of the flight. If
X                        the -alt option is used, the RNAV distance from the
X                        VORTAC will be actual slant range. If -alt is not
X                        used, the RNAV distance with be horizontal range.
X                        If there are fewer altitudes listed than legs then
X                        the last supplied altitude will be used for the 
X                        remaining legs of the flight.
X  -speed <kts>..<kts>   the expected TAS in knots for each leg of the flight.
X                        If the -speed option is used, the output will show
X                        expected ground speed and time for each leg, as well
X                        as elapsed time for the flight. If there are fewer
X                        speeds listed than legs then the last speed supplied
X                        will be used for the remainder of the legs.
X  -wind <wind>..<wind>  the <wind> is in the same format as the "winds aloft"
X                        forcast. For instance, 3320 is read as winds from 330
X                        degrees (true north) at 20 knots. The <wind> is used
X                        to adjust both the magnetic course and ground speed
X                        for each leg of the flight. If there are fewer wind
X                        entries supplied than legs for the flight then the
X                        last supplied wind entry will be used for each 
X                        remaining leg of the flight.
X  -com                  print the comments that apply to each <id>.
X  -airports             print the airports database.
X  -vors                 print the vors database.
X  -k <string>           grep the airports and vors databases for <string>.
X
X
XExamples of program invocation would be -
X 
X nav -from lax -to pdx -rvia fil rom sck ila fjs eug
X nav -from pao -to rno -via sck hnw lta -speed 95 120 120 125
X nav -from sjc -to sac -speed 125 -wind 2420 -com
X nav -from sfo -to lax -rvia sjc prb smo -alt 5000 15000 15000 5000 \
X     -speed 250 400 400 200 -wind 2510 2740 2835 3015
X nav -from emt -to sba -via vny -speed 100 -wind 2730
X
X
X
X    This program was originally posted by Linn Hower. He got it from
X    an anonymous source. Linn modified the program somewhat, and then
X    I modified it substantially. Please remember - ALWAYS check the
X    output for reasonable results by comparing the listed flight
X    against a WAC or SECTIONAL chart.
X
X    Please report problems, questions, difficuties, etc to:
X
X
XFROM:   Robert J. Evans, CAE Systems Division of Tektronix, Inc.
XUUCP:   tektronix!teklds!cae780!rje
X	{ihnp4, decvax!decwrl}!amdcad!cae780!rje 
X        {nsc, hplabs, resonex, qubix, leadsv}!cae780!rje 
XUSNAIL: 5302 Betsy Ross Drive, Santa Clara, CA  95054
XAT&T:   (408)727-1234 x2800
X
X
X
X
!E_O_F!
echo Extracting nav.h ...
sed 's/^X//' >nav.h <<'!E_O_F!'
X/*
X *	Defines and structs for nav navigation program
X */
X
X#define AIRPORTS	"airports"
X#define VORS		"vors"
X
X
X#define pi (3.1415926535897932384626433)
X
X#define MAXAPTS 512	/* Maximum number of airports in APTarray */
X#define MAXVORS 512	/* Maximum number of VORs in VORarray */
X#define MAXVIA 64	/* Maximum number of VORs in ViaArray */
X#define NAMLEN 33	/* Size of name field + EOS */
X#define COMLEN 65	/* Size of comment field + EOS */
X#define IDLEN 6		/* Size of ID field + EOS */
X#define WPLEN 65	/* Size of WP field + EOS */
X
Xstruct lat_lon{
X	double rad;	/* radians */
X	double deg;	/* decimal degrees */
X};
Xstruct fix{
X	struct lat_lon lat;
X	struct lat_lon lon;
X        double radial;
X        double nm;
X};
Xstruct vor{
X	char id[IDLEN];		/* Three letter ID */
X	char name[NAMLEN];	/* Full name of VOR */
X	struct fix loc;		/* Location of the VOR */
X	double var;		/* Magnetic variation in decimal degrees */
X	float freq;		/* Radio frequency */
X	int alt;		/* Altitude of vor in feet */
X                                /* vors = 0 vortacs != 0 */
X	char comments[COMLEN];	/* Comments (optional) */
X	char waypoint[WPLEN];	/* Waypoint (not in VORS entry) */
X};
Xstruct apt{
X	char id[IDLEN];		/* Three letter ID */
X	char city[NAMLEN];	/* Name of nearest city */
X	char name[NAMLEN];	/* Name of airport */
X	int alt;		/* Altitude of airport in feet */
X	struct fix loc;		/* Location of the airport */
X	double var;		/* Magnetic variation in decimal degrees */
X	char comments[COMLEN];	/* Comments (optional) */
X};
!E_O_F!
echo Extracting output.c ...
sed 's/^X//' >output.c <<'!E_O_F!'
Xdouble Distance ();
Xdouble Bearing ();
Xdouble Magnetic ();
Xdouble Degrees();
Xdouble Radians ();
X
X/*
X *	Output formatting and stuff
X */
X#include "nav.h"
X
Xextern int comflg;
Xextern int rviaflg;
X
Xcomment(s)
Xchar *s;
X{
X	register char *p;
X
X	for (p=s; *p != 0; p++)
X		if (*p == '\n')
X			*p = 0;
X	if (comflg && strlen(s))
X		printf("Info: %s \n",s);
X}
X
XPrintWp(vortac)
Xstruct vor *vortac;
X{
X	printf("WayPoint: %s NM\n", vortac->waypoint);
X}
X
X
XPrintVor(vortac)
Xstruct vor *vortac;
X{
X	if (rviaflg) 
X        {
X           printf("\nRvor: %s\t\tFreq: %.1f\n", vortac->name,vortac->freq);
X           printf("ID: %s\tAltitude: %d feet\n",
X		  vortac->id,vortac->alt);
X           PrintWp (vortac);
X        }
X        else
X        {
X           printf("\nvor %s\t\tfreq: %.1f\n", vortac->name,vortac->freq);
X           printf("ID: %s\tAltitude: %d feet\n",
X		   vortac->id,vortac->alt);
X        }
X	comment(vortac->comments);
X
X}
X
XPrintApt(airport)
Xstruct apt *airport;
X{
X	printf("\n\nAirport: %s\tCity: %s\n", airport->name, airport->city);
X	printf("ID: %s\tAltitude: %d feet\n",
X		airport->id,airport->alt);
X	comment(airport->comments);
X}
X
XPrintNav(FromId,ToId,Course,Mag,Dist,TotalDist)
Xchar *FromId, *ToId;
Xdouble Course,Mag,Dist,TotalDist;
X{
X	if (Dist > 0.01){	/* there is some fudge factor here */
X		printf("\t\t%s to %s\nMagnetic:\t\t\t\t\t%03.0f\n",
X			FromId, ToId, Mag);
X		printf("Distance:\t\t\t\t\t%.1f NM\n",
X			Dist);
X		printf("(true course %03.0f, Total distance %.1f)\n",
X			Course,TotalDist);
X	}else{	/* special cased since flying 90 deg for 0 NM is silly */
X		printf("\n%s is at %s\n",
X			FromId, ToId);
X		printf("(Total distance %.1f)\n",
X			TotalDist);
X	}
X}
X
X/*
X * Print a reasonable flight plan guide
X *
X */
XPrintLine ()
X{
Xchar dashes[10];
X   strcpy (dashes, "--------");
X   printf ("+-%8s%8s+-----+-------+-------+-----+-----+-------+%8s%8s-+\n",
X          dashes,dashes,dashes,dashes);
X} 
XPrintHead ()
X{
Xchar from_name[17], to_name[17], from_id[17], to_id[17];
X   strcpy (from_name, "  FROM         ");
X   strcpy (from_id,   "  FREQ/ID/ALT  ");
X   strcpy (to_name,   "  TO           ");
X   strcpy (to_id,     "  FREQ/ID/ALT  ");  
X   printf ("\n");
X   PrintLine();
X   printf ("| %-16s| CRS | Wind  |  Leg  | TAS | Rad | Dist  |%16s |\n",
X           from_name, to_name);
X   printf ("| %-16s| HDG | Alt.  |  Time | GS  | NM  | Time  |%16s |\n",
X           from_id, to_id);
X   PrintLine();
X}
X
XPrintLeg (crs, mag, dist, total, rad, nm, tas, alt, wind, dir, gs, elapse,
X          from_name, from_id, from_freq, from_alt,
X          to_name, to_id, to_freq, to_alt)
Xint tas, alt, wind, dir, gs, *elapse, from_alt, to_alt;
Xdouble crs, mag, dist, total, rad, nm, from_freq, to_freq;
Xchar *from_name[], *from_id[], *to_name[], *to_id[];
X{ int i, t1, t2, t3, t4, w1;
X
X    t1 = 0; t2 = 0; t3 = 0; t4 = 0; 
X    if (gs == 0) gs = tas;
X    if (gs != 0)
X    {
X       t1 = (int) ((dist / gs) * 60);
X       *elapse += t1 ;
X       t2 = t1 % 60;
X       t1 = t1 / 60;
X       t4 = *elapse % 60;
X       t3 = *elapse / 60;
X    }
X    printf("| %-16s| %03.0f |%3d @%2d| %5.1f | %3d | %03.0f | %5.1f | %-16s|\n",
X             from_name, crs, dir, wind, dist, tas, rad, total, to_name);
X    printf("| %5.1f/%4s/%-5d| %03.0f | %5d |  %01d:%02d | %3d |%4.1f | %02d:%02d | %5.1f/%4s/%-5d|\n",
X             from_freq, from_id, from_alt, mag, alt, t1,t2, 
X             gs, nm, t3, t4, to_freq, to_id, to_alt);
X    PrintLine();
X
X}
XFlightGuide(Start_Airport, To_Airport, 
X            fromflg, toflg,
X            altflg, AltArray, 
X            speedflg, SpeedArray,
X            windflg, WindArray,
X            viaflg, rviaflg, ViaC, ViaArray)
Xstruct apt *Start_Airport, *To_Airport;
Xint fromflg, toflg,
X    altflg, AltArray[],
X    speedflg, SpeedArray[],
X    windflg, WindArray[],
X    viaflg, rviaflg, ViaC;
Xstruct vor ViaArray[];
X{
Xint c, last_alt, to_alt, v;
Xint TAS, ALT, WIND, DIR, GS, ELAPSE;
Xdouble Radial, Course, CRS, HDG, Mag, NM, 
X       Dist, TotalDist, last_var, last_freq, to_freq;
Xchar last_name[NAMLEN], to_name[NAMLEN];
Xchar last_id[IDLEN], to_id[IDLEN];
Xstruct fix last_fix;
X 
X        c = 0;
X        v = 0;
X        printf ("\n\n\n\t\t\tFlight Guide\n\n");
X	if (fromflg != 0)
X        {
X           strcpy (last_id, Start_Airport->id);
X           strcpy (last_name, Start_Airport->name);
X           last_alt = Start_Airport->alt;
X           last_fix = Start_Airport->loc;
X           last_var = Start_Airport->var;
X           last_freq = 0.0; 
X        }
X        else
X        {  
X           strcpy (last_id, ViaArray[v].id);
X           strcpy (last_name, ViaArray[v].name);
X           last_alt = ViaArray[v].alt;
X           last_fix = ViaArray[v].loc;
X           last_var = ViaArray[v].var;
X           last_freq = ViaArray[v].freq;
X           PrintHead ();
X           v++;
X        }
X        Dist = 0.0; TotalDist = 0.0; Course = 0.0; Mag = 0.0;
X        TAS = 0; ELAPSE = 0; GS = 0; 
X        for (v = v; v <= ViaC; v++)
X        {
X
X           if ((v < ViaC) || ((v = ViaC) && (toflg == 0)))
X           {
X              if ((v % 5) == 0) PrintHead ();
X              Dist = Distance (last_fix.lat.rad, last_fix.lon.rad,
X                        ViaArray[v].loc.lat.rad, ViaArray[v].loc.lon.rad);
X              Course = Bearing (last_fix.lat.rad, last_fix.lon.rad,
X                        ViaArray[v].loc.lat.rad, ViaArray[v].loc.lon.rad);
X              strcpy (to_name, ViaArray[v].name);
X              strcpy (to_id, ViaArray[v].id);
X              to_freq = ViaArray[v].freq;
X              to_alt = ViaArray[v].alt;
X           }
X           else
X           if (toflg != 0)
X           {
X              if ((v % 5) == 0) PrintHead ();
X              Dist = Distance (last_fix.lat.rad, last_fix.lon.rad,
X                             To_Airport->loc.lat.rad,To_Airport->loc.lon.rad);
X              Course = Bearing (last_fix.lat.rad, last_fix.lon.rad,
X                             To_Airport->loc.lat.rad,To_Airport->loc.lon.rad);
X              strcpy (to_name, To_Airport->name);
X              strcpy (to_id, To_Airport->id);
X              to_freq = 0.0;
X              to_alt = To_Airport->alt;
X           }   
X              TotalDist += Dist;
X              if (rviaflg)
X              {
X                 Radial = ViaArray[v].loc.radial;
X                 NM = ViaArray[v].loc.nm;
X              }
X              else
X              {
X                 Radial = 0.0;
X                 NM = 0.0;
X              }
X              if (speedflg) 
X                 TAS = SpeedArray[v] ;
X              else TAS = 0;
X              if (altflg) 
X                 ALT = AltArray[v] ;
X              else ALT = 0; 
X              if (windflg) 
X                 WIND = WindArray[(v*2)+1] ;
X              else WIND = 0;
X              if (windflg) 
X                 DIR = WindArray[(v*2)] ;
X              else DIR = 0;
X              GS = 0;
X              CRS = Magnetic (Course, last_var);
X	      Mag = Course;
X              if ((windflg != 0) && (speedflg != 0))
X                WindCorrection (TAS, &Mag, WIND, DIR, &GS, last_var);
X              HDG = Magnetic (Mag, last_var);
X              PrintLeg (CRS, HDG, Dist, TotalDist, 
X                        Radial, NM, TAS, ALT,
X                        WIND, DIR, GS, &ELAPSE,
X                        last_name, last_id, last_freq, last_alt,
X                        to_name, to_id, to_freq, to_alt);
X              strcpy (last_name, ViaArray[v].name);
X              strcpy (last_id, ViaArray[v].id);
X              last_fix = ViaArray[v].loc;
X              last_alt = ViaArray[v].alt;
X              last_var = ViaArray[v].var;
X              last_freq = ViaArray[v].freq;
X        }
X/*	if (toflg != 0)
X        {
X           strcpy (to_name, To_Airport->name);
X           strcpy (to_id, To_Airport->id);
X           PrintHead (last_name, last_id, to_name, to_id); 
X           last_alt = To_Airport->alt;
X        }
X*/
X        printf ("\n\n");
X        if (comflg != 0)
X        {
X           if (fromflg != 0)
X              PrintApt (Start_Airport);
X           for (v = 0; v < ViaC; v++)
X              PrintVor (&ViaArray[v]);
X           if (toflg !=0)
X              PrintApt (To_Airport);
X        }
X}
Xdummy ()
X{int i;
X	i = 1;
X}
!E_O_F!
echo Extracting scan.c ...
sed 's/^X//' >scan.c <<'!E_O_F!'
X#include "nav.h"
X#include <ctype.h>
X
X/*
X *     Store the next Alt datum into the AltArray entry given.
X *
X */
XStoreAlt(alt,c,s)
Xint alt[], c;
Xchar *s;
X{
X        
X        alt[c] = atoi (s);
X        return 0;
X}
X/*
X *      Store the next Airspeed datum into the Airspeed array
X *
X */
XStoreSpeed (speed, c, s)
Xint speed[], c;
Xchar *s;
X{
X        speed[c] = atoi (s);
X        return 0;
X}
X/*
X *      Store the next Wind datum into the Wind array
X *
X */
XStoreWind (wind, c, s)
Xint wind[], *c;
Xchar *s;
X{
Xint winds_aloft, direction, speed;
X        winds_aloft = atoi (s);
X        direction = (winds_aloft / 100) * 10;
X        if (direction >= 360) direction = direction - 360;
X        speed = winds_aloft % 100;
X        wind[*c] = direction;
X        wind[*c+1] = speed;
X        return 0;
X}   
X/*
X *	Attempt to find airport in array by matching IDs, put result in airport.
X *	Return 1 on error, 0 on success.
X *	Ignore case by upping case in buf.
X */
XFindApt(airport,s,array,count)
Xstruct apt *airport;
Xchar *s;
Xstruct apt array[];
Xint count;
X{
X	char buf[IDLEN];
X	register int i;
X
X	strcpy(buf,s);
X	uppit(buf);
X	for (i=0; i < count; i++){
X		if (strcmp(array[i].id,buf) == 0){
X			*airport = array[i];
X			return 0;	/* we find only one at a time here */
X		}
X	}
X	return 1;
X}
X
X/*
X *	Attempt to find VOR in array by matching IDs, put result in vortac.
X *	Return 1 on error, 0 on success.
X *	Ignore case by upping case in buf.
X */
XFindVor(vortac,s,array,count)
Xstruct vor *vortac;
Xchar *s;
Xstruct vor array[];
Xint count;
X{
X	char buf[IDLEN];
X	register int i;
X
X	strcpy(buf,s);
X	uppit(buf);
X	for (i=0; i < count; i++){
X		if (strcmp(array[i].id,buf) == 0){
X			*vortac = array[i];
X			return 0;	/* we find only one at a time here */
X		}
X	}
X	return 1;
X}
X
X/*
X *	pretty self-explanatory
X */
Xuppit(s)
Xchar *s;
X{
X	while ((*s != '\0') && (*s != '\n')){
X		if ((isalpha(*s) && islower(*s))){
X			*s=toupper(*s);
X		}
X		if (isspace(*s)){
X			*s=' ';		/* Guarantee that it's a blank char */
X		}
X		s++;
X	}
X}
!E_O_F!
echo Extracting airports ...
sed 's/^X//' >airports <<'!E_O_F!'
X#
X# CALIFORNIA TOWER AIRPORTS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		City	name of nearest city, up to 32 chars
X#		Name	airport name, up to 32 chars
X#		Alt	airport altitude in feet
X#		Variation	magnetic var. (+W/-E) degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X#
X# Data taken from Pilots Guide to California Airports [15-june-85]
X#             and Airport / Facility Directory [26-sept-85]
X#
X# SNS Salinas Muni Lat corrected 09-24-85
X#
XBFL:Bakersfield:Meadows Field:490:-16:00:35:25.8:119:03.1:
XBUR:Burbank:Burbank-Glendale-Pasadena:775:-15:00:34:12:118:21.4:
XCRQ:Carlsbad:McClellan-Palomar:328:-15:00:33:07.7:117:16.8:
XCIC:Chico:Chico Muni:238:-18:00:39:47.7:121:56.4:
XCNO:Chino:Chino:650:-15:00:33:58.5:117:38.2:
XCCR:Concord:Buchanan Field:23:-17:00:37:59.4:122:03.3:
XEMT:El Monte:El Monte:296:-15:00:34:05.2:118:02:
XFAT:Fresno:Fresno Air Terminal:332:-17:00:36:46.6:119:43:
XFCH:Fresno:Fresno-Chandler:278:-17:00:36:43.9:119:49.1:
XFUL:Fullerton:Fullerton Muni:96:-15:00:33:52.3:117:58.7:
XHHR:Hawthorne:Hawthorne Muni:63:-15:00:33:55.4:118:20:
XHWD:Hayward:Hayward Air Terminal:47:-17:00:37:39.6:122:07.3:
XIPL:Imperial:Imperial County:-56:-14:00:32:50.2:115:34.5:
XWJF:Lancaster:Gen. Wm.J.Fox Field:2347:-15:00:34:44.5:118:13.1:
XPOC:LaVerne:Brackett Field:1011:-15:00:34:05.5:117:46.8:
XLVK:Livermore:Livermore:397:-17:00:37:41.6:121:49:
XLGB:Long Beach:Daugherty Field:57:-15:00:33:49:118:09:
XLAX:Los Angeles:Los Angeles Int:126:-15:00:33:56.5:118:24.4:
XMYV:Marysville:Yuba County:62:-18:00:39:05.9:121:34.1:
XMCE:Merced:Merced Muni:152:-17:00:37:17.1:120:30.8:
XMOD:Modesto:Modesto City-Co. Harry Sham Field:97:-17:00:37:37.6:120:57.2:
XMRY:Monterey:Monterey Peninsula:244:-17:00:36:35.3:121:50.9:
XAPC:Napa:Napa County:33:-17:00:38:12.8:122:16.8:
XOAK:Oakland:Oakland Int:6:-17:00:37:43.3:122:13.2:
XONT:Ontario:Ontario Int:952:-15:00:34:03.3:117:36.2:
XOXR:Oxnard:Oxnard:43:-15:00:34:12:119:12.4:
XPSP:Palm Springs:Palm Springs Muni:448:-15:00:33:49.6:116:30.2:
XPAO:Palo Alto:Palo Alto:5:-17:00:37:27.7:122:06.8:
XRDD:Redding:Redding Muni:502:-18:00:40:30.6:122:17.5:
XRAL:Riverside:Riverside Muni:816:-15:00:33:57.1:117:26.6:
XSAC:Sacramento:Sacramento Executive:21:-17:00:38:30.7:121:29.6:
XSMF:Sacramento:Sacramento Metro:23:-17:00:38:41.7:121:36:
XSNS:Salinas:Salinas Muni:84:-17:00:36:39.7:121:36.3:
XSQL:San Carlos:San Carlos:4:-17:00:37:30.7:122:14.9:
XSDM:San Diego:Brown Field:524:-14:00:32:34.3:116:58.8:
XSEE:San Diego / El Cajon:Gillespie Field:385:-14:00:42:49.6:116:58.3:
XSAN:San Diego:Lindbergh Int:15:-14:00:32:44:117:11.2:
XMYF:San Diego:Montgomery Field:423:-14:00:32:48.9:117:08.4:
XSFO:San Francisco:San Francisco Int:11:-17:00:37:37.1:122:22.4:
XSJC:San Jose:San Jose Int:56:-17:00:37:21.7:121:55.6:
XRHV:San Jose:Reid-Hillview:133:-17:00:37:20:121:49.1:
XSNA:Santa Ana:John Wayne:53:-15:00:33:40.5:117:52:
XSBA:Santa Barbara:Santa Barbara Muni:10:-16:00:34:25.6:119:50.4:
XSMX:Santa Maria:Santa Maria Public:259:-16:00:34:53.9:120:27.4:
XSMO:Santa Monica:Santa Monica Muni:175:-15:00:34:00.9:118:27:
XSTS:Santa Rosa:Sonoma County:125:-18:00:38:30.5:122:48.7:
XTVL:Tahoe:South Lake Tahoe:6264:-18:00:38:53.6:119:59.7:
XSCK:Stockton:Stockton Metro:29:-17:00:37:53.6:121:14.2:
XTOA:Torrance:Torrance Muni:101:-15:00:33:48.2:118:20.3:
XVNY:Van Nuys:Van Nuys:799:-15:00:34:12.6:118:29.3:
X#
X# NEVADA TOWER AIRPORTS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		City	name of nearest city, up to 32 chars
X#		Name	airport name, up to 32 chars
X#		Alt	airport altitude in feet
X#		Variation	magnetic var. (+W/-E) degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X#
X# Data taken from Pilots Guide to Southwestern Airports [15-may-85]
X#             and Airport / Facility Directory [26-sept-85]
X#
XLAS:Las Vegas:McCarran Int:2174:-14:00:36:05:115:10.2:
XVGT:Las Vegas:North Las Vegas Air Terminal:2207:-14:00:36:12.8:115:11.8:
XRNO:Reno:Cannon Int:4412:-16:00:39:29.9:119:46.1:
X#
X# OREGON TOWER AIRPORTS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		City	name of nearest city, up to 32 chars
X#		Name	airport name, up to 32 chars
X#		Alt	airport altitude in feet
X#		Variation	magnetic var. (+W/-E) degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X# Data taken from Flight Guide Volume I [15-june-85]
X#             and Airport / Facility Directory [25-oct-84]
X#
XEUG:Eugene:Mahlon Sweet Field:365:-20:00:44:07.3:123:13:
XLMT:Klamath Falls:Kingsley Field:4092:-19:00:42:09.5:121:43.6:
XMFR:Medford:Jackson County:1330:-19:00:42:22.3:122:52.3:
XPDT:Pendleton:Pendleton Muni:1494:-20:00:45:41.7:118:50.5:
XPDX:Portland:Portland Int:26:-21:00:45:35.3:122:35.8:
XHIO:Portland:Portland-Hillsboro:204:-21:00:45:32.4:122:56.9:
XTTD:Portland:Portland-Troutdale:35:-21:00:45:33:122:23.8:
XSLE:Salem:McNary:210:-21:00:44:54.6:123:00.1:
X#
X# CALIFORNIA NON-TOWER AIRPORTS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		City	name of nearest city, up to 32 chars
X#		Name	airport name, up to 32 chars
X#		Alt	airport altitude in feet
X#		Variation	magnetic var. (+W/-E) degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X#
X# Data taken from Pilots Guide to California Airports [15-june-85]
X# 0O1 Atwater Muni ID corrected 10-18-85
X# 0O4 Corning ID corrected 10-18-85
X# L01 Crystal ID corrected 10-18-85
X# 0O5 Davis University ID corrected 10-18-85
X# 2Q3 Winters-Davis Lon corrected 12-1-85
X# CXL Calexico Intl Lon corrected 12-1-85
X# RIR Fla-Bob Lat, Lon corrected 12-2-85
X#
XL70:Agua Dulce:Agua Dulce Airpark:2660:-14:00:34:30:118:19:
XCA02:Alturas:California Pines:4398:-18:00:41:25:120:41:
XO00:Alturas:Alturas Muni:4375:-18:00:41:29:120:34:
X203:Angwin:Angwin:1848:-17:00:38:35:122:26:
XO12:Antioch:Antioch:185:-16:00:37:58:121:48:
XAPV:Apple Valley:Apple Valley:3059:-14:00:34:35:117:11:
XACV:Arcata:Arcata-Eureka:218:-18:00:40:59:124:06:
X0O1:Atwater:Atwater Muni:145:-16:00:37:20:120:36:
XAUN:Auburn:Auburn Muni:1520:-17:00:38:57:121:05:
XAVX:Avalon:Catalina:1602:-14:00:33:24:118:25:
XL45:Bakersfield:Bakersfield Airpark:378:-15:00:35:20:119:00:
XL91:Bakersfield:Rio Bravo:796:-15:00:35:24:118:51:
XBNG:Banning:Banning Muni:2219:-14:00:33:55:116:51:
XO02:Beckwourth:Beckwourth:4894:-17:00:39:49:120:21:
XUDD:Indio:Bermuda Dunes:69:-14:00:33:35:116:16:
XL35:Big Bear:Big Bear:6750:-14:00:34:16:116:51:
XBIH:Bishop:Bishop:4120:-16:00:37:22:118:22:
XBLH:Blythe:Blythe:397:-14:00:33:37:114:43:
XL60:Boron:Boron Airstrip:2499:-14:00:35:00:117:36:
XL08:Borrego Springs:Borrego Valley:520:-14:00:33:16:116:19:
XBWC:Brawley:Brawley Muni:128:-13:00:32:59:115:31:
XO57:Bridgeport:Bryant:6468:-16:00:38:16:119:13:
XCXL:Calexico:Calexico Int:0:-14:00:32:40:115:31:
XL71:Calif. City:Calif. City:2347:-15:00:35:09:118:01:
XCLR:Calipatria:Calipatri Muni:180:-14:00:33:08:115:31:
XO58:Calistoga:Calistoga:350:-17:00:38:35:122:34:
XCMA:Camarillo:Camarillo:79:-14:00:34:12:119:06:
XO61:Shingle Springs:Cameron Park:1286:-16:00:38:41:120:59:
XO62:Carmel Valley:Carmel Valley:450:-16:00:36:29:121:44:
XO59:Cedarville:Cedarville:4623:-18:00:41:33:120:10:
XO05:Chester:Chester:4525:-17:00:40:17:121:14:
XO23:Chico:Chico Ranchaero:173:-17:00:39:43:121:52:
XL77:Chiriaco:Chiriaco Summit:1713:-14:00:33:40:115:42:
X2O6:Chowchilla:Chowchilla:242:-16:00:37:07:120:15:
XO60:Cloverdale:Cloverdale:272:-17:00:38:46:122:59:
X3O8:Coalinga:Harris Ranch:465:-15:00:36:15:120:14:
XCLG:Coalinga:Coalinga Muni:714:-15:00:36:10:120:22:
XO22:Columbia:Columbia:2117:-16:00:38:02:120:25:
XO08:Colusa:Colusa County:47:-17:00:39:11:121:59:
XCPM:Compton:Compton:97:-14:00:33:53:118:15:
XCRO:Corcoran:Corcoran:197:-14:00:36:06:119:36:
X0O4:Corning:Corning:293:-17:00:39:57:122:10:
XL66:Corona:Corona Muni:533:-14:00:33:54:117:36:
XO09:Covelo:Round Valley:1434:-17:00:39:47:123:16:
XCEC:Crescent City:Crescent City:57:-18:00:41:47:124:14:
XDAG:Daggett:Barstow-Daggett:1927:-14:00:34:51:116:47:
X0O5:Davis:University:68:-17:00:38:32:121:47:
XL06:Furnace Creek:Death Valley-Natl Monument:-211:-15:00:36:28:116:53:
XL09:Stovepipe Wells:Death Vally-Stovepipe:40:-15:00:36:36:117:09:
XDLO:Delano:Delano Muni:313:-15:00:35:45:119:14:
XQ25:Fortuna:Dinsmore:2375:-18:00:40:30:123:36:
XO10:Dinuba, Alta:Alta:364:-16:00:36:32:119:19:
XQ38:Dos Palos:Dos Palos:118:-16:00:36:58:120:38:
X106:Dunsmuir:Dunsmuir Muni:3258:-18:00:41:16:122:16:
XL69:Adelanto:El Mirage:2865:-14:00:34:37:117:36:
XBLU:Emigrant Gap:Blue Canyon:5284:-17:00:39:16:120:42:
XEKA:Eureka:Murray Field:7:-18:00:40:48:124:07:
XO11:Fair Oaks:Phoenix Field:271:-16:00:38:39:121:13:
XL18:Fallbrook:Fallbrook Community Airpark:708:-14:00:33:21:117:15:
XO89:Fall River Mills:Fall River Mills:3323:-18:00:41:01:121:26:
XL73:Famoso:Poso:635:-15:00:35:36:119:08:
XCA06:Fort Jones:Scott Valley:2728:-18:00:41:33:122:51:
XFOT:Fortuna:Rohnerville:390:-18:00:40:33:124:08:
XQ59:Fremont:Fremont:4:-16:00:37:27:121:56:
XQ60:Fresno:Sierra Sky Park:321:-16:00:36:50:119:52:
XO16:Garberville:Garberville:546:-17:00:40:05:123:49:
XQ61:Georgetown:Georgetown:2640:-17:00:38:55:120:52:
XO17:Grass Valley:Nevada County:3150:-17:00:39:13:121:00:
XQ68:Groveland:Pine Mtn. Lake:2900:-16:00:37:52:120:11:
XHAF:Half Moon Bay:Half Moon Bay:67:-16:00:37:31:122:30:
XO18:Hanford:Hanford Muni:248:-15:00:37:31:122:30:
XQ72:Hayfork:Hayfork:2321:-17:00:40:33:123:11:
XO31:Healdsburg:Healdsburg:300:-17:00:38:39:122:54:
XHMT:Hemet:Ryan:1512:-14:00:33:44:117:01:
XL26:Hesperia:Hesperia:3390:-14:00:34:23:117:19:
X3O7:Hollister:Hollister:233:-16:00:36:53:121:24:
XL16:Huntington Beach:Meadowlark:28:-14:00:33:43:118:02:
XQ75:Hyampon:Hyampon:1250:-18:00:40:38:123:28:
X2O7:Independence:Independence:3900:-15:00:36:49:118:12:
XIYK:Inyokern:Inyokern:2457:-15:00:35:40:117:50:
XO70:Jackson:Westover:1649:-16:00:38:23:120:48:
XL78:Jacumba:Jacumba:2820:-13:00:32:37:116:10:
XL80:Joshua Tree:Hi-Desert:2462:-14:00:34:09:116:15:
XL05:Kernville:Kern Valley:2614:-15:00:35:44:118:25:
XKIC:King City:King City:370:-16:00:36:14:121:07:
X1O2:Lakeport:Lampson:1380:-17:00:38:59:122:54:
XO24:Lee Vining:Lee Vining:6802:-16:00:37:57:119:06:
XO51:Lincoln:Lincoln Muni:119:-17:00:38:54:121:21:
XO48:Little River:Little River:572:-17:00:39:16:123:45:
XL01:Llano:Crystal:3420:-14:00:34:29:117:49:
XO20:Lodi:Kingdon:15:-16:00:38:05:121:21:
X1O3:Lodi:Lodi:58:-16:00:38:12:121:16:
XLPC:Lompoc:Lompoc:88:-15:00:34:40:120:28:
XO26:Lone Pine:Lone Pine:3680:-15:00:36:35:118:03:
XWHP:San Fernando:Whiteman:1004:-14:00:34:16:118:25:
XLSN:Los Banos:Los Banos Muni:119:-16:00:37:04:120:52:
XL84:Lost Hills:Lost Hills:274:-15:00:35:37:119:41:
X2O9:Clear Lake:Pearce:1385:-17:00:38:56:122:37:
XMAE:Madera:Madera Muni:253:-16:00:36:59:120:07:
XMMH:Mammoth Lakes:Mammoth Lakes:7128:-16:00:37:38:118:51:
XQ81:Manton:Manton:2030:-18:00:40:27:121:53:
XO68:Mariposa:Mariposa-Yosemite:2252:-16:00:37:31:120:02:
XMHV:Mohave:Mohave:2787:-15:00:35:03:118:09:
XSIY:Montague:Siskiyou:2648:-18:00:41:47:122:28:
X1O5:Montague:Montague-Yreka:2258:-18:00:41:44:122:33:
XEED:Needles:Needles:990:-14:00:34:46:114:37:
XL88:New Cayuma:New Cayuma:2203:-15:00:34:56:119:41:
XO56:Novato:Gnoss:1:-16:00:38:09:122:33:
XO27:Oakdale:Oakdale:234:-16:00:37:45:120:48:
XL52:Oceano:Oceano County:14:-15:00:35:06:120:37:
XL32:Oceanside:Oceanside Muni:28:-14:00:33:13:117:21:
XL90:Ocotillo:Ocotillo Wells:160:-14:00:33:09:116:08:
XO37:Orland:Haigh:220:-17:00:39:43:122:09:
XOVE:Oroville:Oroville Muni:199:-17:00:39:29:121:37:
XQ88:Paradise:Paradise Skypark:1300:-17:00:39:43:121:37:
XPRB:Paso Robles:Paso Robles:836:-15:00:35:40:120:38:
XL65:Perris:Perris Valley:1413:-14:00:33:46:117:13:
XO69:Petaluma:Petaluma Sky Ranch:79:-17:00:38:15:122:37:
XQ90:Pixley:Pixley:256:-15:00:35:58:119:18:
XPVF:Placerville:Placerville:2583:-16:00:38:43:120:45:
XPTV:Porterville:Porterville:444:-15:00:36:02:119:04:
X2O1:Quincy:Ganser:3415:-17:00:39:57:120:57:
XL39:Ramona:Ramona:1393:-14:00:33:02:116:55:
X0Q7:Rancho Murieta:Rancho Murieta:142:-16:00:38:29:121:06:
XRBL:Red Bluff:Red Bluff Muni:349:-17:00:40:09:122:15:
XO85:Redding:Benton:719:-18:00:40:34:122:24:
XQ93:Redding:Enterprise:580:-18:00:40:35:122:19:
XO74:Redding:Sky Ranch:502:-17:00:40:30:122:23:
XL12:Redlands:Redlands Muni:1572:-14:00:34:05:117:09:
XO32:Reedley:Reedley:383:-15:00:36:40:119:27:
XL67:Rialto:Miro Field:1438:-14:00:34:08:117:24:
XQ94:McClellan:Rio Linda:45:-17:00:38:41:121:27:
XO88:Rio Vista:Rio Vista Muni:45:-16:00:38:10:121:41:
XRIR:Riverside:Fla-Bob:764:-14:00:33:59.3:117:24.5:
XL00:Rosamond:Rosamond:2415:-14:00:34:52:118:12:
XQ95:Ruth:Ruth:2767:-17:00:40:13:123:18:
XQ96:Sacramento:Natomas:22:-17:00:38:38:121:31:
X0O3:San Andreas:Calaveras County:1319:-16:00:38:09:120:39:
XSBP:San Luis Obispo:San Luis Obispo Muni:208:-15:00:35:14:120:38:
XQ99:San Martin:South County:281:-16:00:37:05:121:36:
XCA35:San Rafael:Marin Ranch:5:-16:00:38:01:122:31:
XO77:Pine Flat Reservoir:Sanger, Wonder Valley:662:-15:00:36:48:119:18:
XSZP:Santa Paula:Santa Paula:245:-14:00:34:21:119:04:
XO01:Santa Rosa:Santa Rosa Air Center:100:-17:00:38:25:122:45:
XIZA:Santa Ynez:Santa Ynez:671:-15:00:34:36:120:04:
X0Q3:Sonoma:Schellville - Sonoma Valley:5:-17:00:38:13:122:27:
X0Q4:Selma:Selma:305:-15:00:36:35:119:39:
XMIT:Shafter:Shafter, Minter:425:-15:00:35:30:119:12:
X0Q5:Shelter Cove:Shelter Cove:69:-18:00:40:02:124:04:
X0Q9:Sonoma:Sonoma Skypark:20:-17:00:38:15:122:26:
X1Q0:Stratford:Stratford, Newton:194:-15:00:36:09:119:51:
X1Q1:Strathmore:Strathmore, Eckert:426:-15:00:36:10:119:03:
XSVE:Susanville:Susanville Muni:4125:-17:00:40:23:120:34:
XL17:Taft:Taft:875:-15:00:35:08:119:26:
XL94:Tehachapi:Tehachapi, Fantasy Heaven:4220:-15:00:35:06:118:25:
XTSP:Tehachapi:Tehachapi Muni:4002:-15:00:35:08:118:26:
X2L0:Temecula:Temecula, Rancho California:1015:-14:00:33:30:117:10:
XTRM:Thermal:Thermal:117:-14:00:33:38:116:10:
XO36:Tracy:Tracy:192:-16:00:37:41:121:26:
XO86:Trinity:Trinity Center:2390:-18:00:40:59:122:42:
XTRK:Truckee:Truckee - Tahoe:5900:-17:00:39:19:120:08:
XTLR:Tulare:Tulare Muni:271:-15:00:36:09:119:20:
XO81:Tulelake:Tulelake:4048:-18:00:41:53:121:21:
XO14:Turlock:Turlock Airpark:100:-16:00:37:28:120:51:
XO15:Turlock:Turlock Muni:159:-16:00:37:29:120:42:
XTNP:Twentynine Palms:Twentynine Palms:1905:-14:00:34:08:115:57:
XUKI:Ukiah:Ukiah Muni:616:-17:00:39:08:123:12:
XCCB:Upland:Cable:1450:-15:00:34:07:117:41:
X1Q5:Lake Pillsbury:Upper Lake, Gravelly Valley:1900:-17:00:39:27:122:57:
XO45:Vacaville:Nut Tree:113:-17:00:38:23:121:58:
XVIS:Visalia:Visalia Muni:292:-15:00:36:19:119:24:
X2Q1:Visalia:Green Acres:317:-15:00:36:20:119:19:
XQ31:Visalia:Sequoia:313:-16:00:36:27:119:19:
XL19:Wasco:Wasco:313:-15:00:35:37:119:21:
XWVI:Watsonville:Watsonville Muni:160:-16:00:36:56:121:47:
XO54:Weaverville:Weaverville:2350:-18:00:40:45:122:55:
XO46:Weed:Weed:2938:-18:00:41:28:122:27:
XO28:Willits:Ells Field:2054:-17:00:39:27:123:22:
XWLW:Willows:Glenn County:138:-17:00:39:31:122:13:
X2Q3:Davis:Winters-Davis, Yolo County:98:-17:00:38:34.7:121:51.3:
XO42:Woodlake:Woodlake:425:-15:00:36:24:119:06:
XO41:Woodland:Watts:125:-17:00:38:40:121:52:
XO52:Yuba City:Sutter County:58:-17:00:39:08:121:36:
XL22:Yucca Valley:Yucca Valley:3224:-14:00:34:08:116:24:
X#
X# NEVADA NON TOWER AIRPORTS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		City	name of nearest city, up to 32 chars
X#		Name	airport name, up to 32 chars
X#		Alt	airport altitude in feet
X#		Variation	magnetic var. (+W/-E) degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X#
X# Data taken from Pilots Guide to Southwestern Airports [15-may-85]
X#             and Airport / Facility Directory [26-sept-85]
X# This file does not include airports listed as "seldom used"
X#
X9U3:Austin:Austin:5730:-16:00:39:28.1:117:11.7:
XBAM:Battle Mountain:Lander County:4532:-16:00:40:35.9:116:52.5:
XBTY:Beatty:Beatty:3170:-15:00:36:51.7:116:47.2:
XBLD:Boulder City:Boulder City Muni:2458:-14:00:35:57.8:114:51.1:
X1L4:Searchlight:Kidwell:2605:-14:00:35:18.3:114:52.9:
XO04:Carson City:Carson:4697:-16:00:39:11.5:119:44.1:
X2Q5:Carson City:Parker Carson:4900:-16:00:39:12.1:119:41.0:
X9V7:Currant:Currant Ranch Airport:5180:-15:00:38:44:115:29.1:
XEKO:Elko:Elko Muni:5135:-16:00:40:49.4:115:47.4:
XELY:Ely:Ely-Yelland:6255:-15:00:39:17.9:114:50.5:
X05U:Eureka:Eureka:5946:-16:00:39:36:116:00.3:
XFLX:Fallon:Fallon Muni:3959:-16:00:39:30:118:45:
XGAB:Gabbs:Gabbs:4678:-16:00:38:55:117:57:
X0L5:Goldfield:Goldfield:5680:-15:00:37:43.1:117:14.3:
X0L4:Goldfield:Lida Junction:4684:-15:00:37:29.2:117:11.4:
XHTH:Hawthorne:Hawthorne Muni:4215:-16:00:38:32.7:118:38:
X06U:Jackpot:Jackpot Muni:5217:-17:00:41:58.3:114:40.2:
X0L7:Jean:Jean:2833:-14:00:35:46:115:20:
XU75:Jackass:Jackass Aeropark:2640:-15:00:36:38.1:116:24.8:
XLOL:Lovelock:Derby Field:3903:-17:00:40:04.1:118:33.7:
XDRA:Mercury:Desert Rock:3314:-15:00:36:37.2:116:01.9:
X3Q0:Mina:Mina:4552:-16:00:38:23:118:06:
XMEV:Minden:Douglas County:4718:-16:00:39:00:119:45.1:
X0L9:Overton:Echo Bay:1500:-14:00:36:18.7:114:27.5:
XU08:Overton:Overton Muni:1381:-14:00:36:34.2:114:26.5:
X10U:Owyhee:Owyhee:5375:-17:00:41:57:116:11:
X1L1:Panacea:Lincoln County:4828:-14:00:37:47.3:114:25.3:
X4SD:Reno:Reno - Stead:5046:-17:00:39:40.3:119:52.7:
X14U:Round Mountain:Round Mountain:5764:-16:00:38:43.3:117:19.9:
X3L2:Sandy Valley:Sky Ranch Estates:2599:-14:00:35:47.7:115:37.6:
X3Q1:Schurz:Schurz:4209:-16:00:38:56.2:118:48.3:
X1L3:Searchlight:Searchlight:3405:-14:00:35:26.5:114:54:
X3Q2:Silver Peak:Silver Peak Airstrip:4270:-15:00:37:45.8:117:37.7:
XTPH:Tonopah:Tonopah:5427:-15:00:38:03.5:117:05:
X3Q4:Wellington:Farias Wheel:4820:-16:00:38:50:119:24:
XLWL:Wells:Harriet Field:5772:-16:00:41:07.1:114:55.3:
XWMC:Winnemucca:Winnemucca Muni:4303:-17:00:40:53.8:117:48.1:
XO43:Yerington:Yerington:4378:-16:00:39:00.3:119:09.4:
X#
X# OREGON  NON TOWER AIRPORTS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		City	name of nearest city, up to 32 chars
X#		Name	airport name, up to 32 chars
X#		Alt	airport altitude in feet
X#		Variation	magnetic var. (+W/-E) degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X#
X# Data taken from Flight Guide Volume I [15-june-85]
X#             and Airport / Facility Directory [25-oct-84]
X# This file does not include airports listed as "seldom used"
X#
XS12:Albany:Albany Muni:220:-20:00:44:38:122:03:
XOR03:Alkali Lake:Alkali Lake State:4313:-19:00:43:05:119:59:
X1S8:Arlington:Arlington Muni:890:-22:00:45:43:120:10:
XS03:Ashland:Ashland Muni, Sumner Parker Field:1894:-19:00:42:12:122:40:
XAST:Astoria:Port of Astoria:11:-22:00:46:10:123:53:
X3S2:Aurora:Aurora State:195:-21:00:45:15:122:46:
XBKE:Baker:Baker Muni:3369:-20:00:44:50:117:49:
XS05:Bandon:Bandon State:114:-19:00:43:05:124:25:
X2S2:Beaver Marsh:Beaver Marsh State:4638:-19:00:43:08:121:49:
XS07:Bend:Bend Muni:3450:-20:00:44:06:121:12:
XBOK:Brookings:Brookings State:458:-18:00:42:04:124:17:
XBNO:Burns:Burns Muni:4144:-20:00:43:36:118:57:
X3S4:Cave Junction:Illinois Valley USFS:1389:-19:00:42:06:123:41:
XCZK:Cascade Locks:Stevenson State:151:-19:00:45:40:121:53:
X62S:Christmas Valley:Christmas Valley:4350:-18:00:43:14:120:40:
X2S7:Chiloquin:Chiloquin State:4217:-19:00:42:35:121:53:
X3S9:Condon:Condon State:2912:-19:00:45:15:120:10:
X4S4:Cornelius:Skyport:174:-19:00:45:35:123:03:
XCVO:Corvallis:Corvallis Muni:246:-21:00:44:30:123:17:
X61S:Cottage Grove:Cottage Grove State:641:-20:00:43:48:123:02:
X77S:Creswell:Hobby:535:-19:00:43:56:123:00:
X46S:Dallas:Card's Airpark:377:-19:00:44:56:123:19:
X5S6:Denmark:Cape Blanco State:214:-19:00:42:51:124:32:
X5S7:Echo:West Buttercreek:917:-19:00:45:39:119:24:
X5S9:Estacada:Estacada:750:-21:00:45:19:122:19:
X6S2:Florence:Florence Muni:46:-20:00:43:59:124:07:
XS45:Gleneden Beach:Siletz Bay State:62:-21:00:44:53:124:02:
X4S1:Gold Beach:Gold Beach Muni:16:-19:00:42:25:124:25:
X3S8:Grants Pass:Josephine County:1122:-19:00:42:31:123:22:
XS15:Happy Valley:Happy Valley Airpark:797:-19:00:45:27:122:30:
XS22:Hermiston:Hermiston Muni:637:-20:00:45:50:119:16:
X7S3:Hillsboro:Stark's Twin Oaks Airpark:160:-19:00:45:26:122:56:
X4S2:Hood River:Hood River:631:-21:00:45:40:121:32:
X7S9:Hubbard:Lenhardt Airpark:165:-19:00:45:11:122:45:
X7S5:Independence:Independence State:175:-21:00:44:52:123:12:
XU33:John Day:John Day State:3700:-20:00:44:24:118:58:
X4S3:Joseph:Joseph State:4130:-19:00:45:22:117:16:
XLGD:LaGrande:LaGrande Muni:2713:-20:00:45:17:118:00:
X9S9:Lexington:Lexington:1634:-19:00:45:27:119:41:
X9S3:Lakeside:Lakeside State:20:-19:00:43:35:124:11:
XLKV:Lakeview:Lake County:4728:-19:00:42:10:120:24:
XS30:Lebanon:Lebanon State:340:-19:00:44:32:122:56:
X4S7:Malin:Malin:4050:-18:00:42:00:121:24:
XS33:Madras:Madras City - County:2434:-20:00:44:40:121:09:
X4S5:McMinnville:McMinnville Muni:156:-21:00:45:12:123:08:
X10S:Molalla:Hutchinson:360:-19:00:45:09:122:37:
X4S9:Mulino:Mulino:250:-19:00:45:13:122:36:
X16S:Myrtle Creek:Tri-City State:619:-19:00:43:00:123:19:
X2S6:Newberg:Sportsman Airpark:178:-21:00:45:18:122:57:
XONP:Newport:Newport Muni:160:-21:00:44:35:124:03:
X5S0:Oakridge:Oakridge State:1450:-20:00:43:45:122:30:
XOTH:North Bend:North Bend Muni:14:-20:00:43:25:124:15:
XONO:Ontario:Ontario Muni:2189:-19:00:44:01:117:01:
X0S2:Oregon City:Oregon City Airpark:395:-19:00:45:17:122:36:
XPFC:Pacific:Pacific State:5:-19:00:45:12:123:58:
X6S6:Powers:Powers State:280:-19:00:45:22:124:04:
XS39:Prineville:Prineville:3246:-20:00:44:17:120:54:
X64S:Prospect:Prospect State:2500:-19:00:42:45:122:29:
XRDM:Redmond:Roberts:3077:-20:00:44:15:121:09:
XREO:Rome:Rome State:4053:-19:00:42:35:117:53:
XRBG:Roseburg:Roseburg Muni:525:-20:00:43:14:123:21:
X5S1:Roseburg:Felt:440:-20:00:43:14:123:24:
XS48:Sandy:Country Squire Airpark:1140:-21:00:45:21:122:16:
X03S:Sandy:Rich's:680:-21:00:45:24:122:14:
X1S4:Scappoose:Scappoose Ind. Airpark:55:-21:00:45:46:122:52:
X56S:Seaside:Seaside State:6:-21:00:46:01:123:54:
X6K5:Sisters:Sisters Eagle Airpark:3350:-20:00:44:18:121:32:
XS21:Sunriver:Sunriver:4156:-20:00:45:53:121:27:
X3S3:Suthrelin:Sutherlin Muni:501:-20:00:43:23:123:20:
XDLS:The Dalles:The Dalles Muni:243:-21:00:45:37:121:10:
XS47:Tillamook:Tillamook:35:-21:00:45:25:123:49:
XS49:Vale:Miller Memorial Airpark:2250:-18:00:43:58:117:16:
X35S:Wasco:Wasco State:1459:-20:00:45:35:120:41:
!E_O_F!
echo Extracting vors ...
sed 's/^X//' >vors <<'!E_O_F!'
X#
X#       CALIFORNIA VORS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		Name	VOR name, up to 32 chars
X#		Freq	VOR frequency
X#               Altitude        Altitude of VOR/VORTAC VOR = 0 VORTAC != 0    
X#		Variation	magnetic var. (+W/-E) in degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X# Data taken from Pilot's Guide to California Airports [15-august-85]
X#             and Airport / Facility Directory [26-sept-85]
X#
X# Note: Vors have the altitude set to zero (0).
X#       Vortacs have actual altitude for computation of
X#       slant range. Vortac Altitude must be non-zero.
X#
XAHO:Amedee:109.0:4006:-17:0:40:16.1:120:09:T Reno FSS No Voice
XACV:Arcata:110.2:195:-17:0:40:58.9:124:06.4:T Arcata FSS tweb
XAVE:Avenal:117.1:710:-16:0:35:38.8:119:58.6:H Bakersfield FSS
XBFL:Bakersfield:115.4:554:-16:0:35:29.1:119:05.8:H Bakersfield FSS tweb
XBSR:Big Sur:114.0:4080:-16:0:36:10.9:121:38.5:L Salinas FSS
XBIH:Bishop:109.6:4120:-17:0:37:22.6:118:21.9:T Tonopah FSS No Voice
XBLH:Blythe:117.4:410:-14:0:33:35.8:114:45.6:H San Diego FSS
XCMA:Camarillo:115.8:60:-15:0:34:12.8:119:05.6:L Santa Barbara FSS No Voice
XCIC:Chico:109.8:220:-18:0:39:47.4:121:50.8:T Red Bluff FSS
XCCR:Concord:117.0:5:-17:0:38:02.7:122:02.6:T Oakland FSS
XCEC:Crescent City:109.0:50:-19:0:41:46.8:124:14.4:L Arcata FSS
XDAG:Daggett:113.2:1760:-15:0:34:57.8:116:34.6:H Ontatio FSS tweb
XEDW:Edwards:116.4:2300:-15:0:34:58.9:117:43.9:L Lancaster FSS Military
XNZJ:El Toro MCAS:117.2:383:-15:0:33:40.6:117:43.9:L Ontario FSS Military
XFLW:Fellows:117.5:3870:-16:0:35:05.6:119:51.9:L Bakersfield FSS
XFIM:Fillmore:112.5:2200:-15:00:34:21.4:118:52.8:L Santa Barbara FSS tweb
XFJS:Fort Jones:109.6:4900:-19:0:41:27:122:48.3:L Red Bluff FSS tweb
XFOT:Fortuna:114.0:400:-19:0:40:40.3:124:14:L Arcata FSS tweb
XFAT:Fresno:112.9:360:-17:00:36:53.2:119:48.2:H Fresno FSS tweb
XFRA:Friant:115.6:2380:-17:00:37:06.3:119:35.7:L Fresno FSS
XGVO:Gaviota:116.5:2620:-16:00:34:31.9:120:05.4:L Santa Barbara FSS  IN PROHIBITED AREA P-66
XGFS:Goffs:114.4:4000:-15:0:35:07.9:115:10.5:L Ontario FSS tweb
XGMN:Gorman:116.1:4920:-16:00:34:48.3:118:51.3:L Bakersfield FSS
XHNW:Hangtown:115.5:2602:-17:00:38:43.5:120:44.9:L Sacramento FSS tweb
XHEC:Hector:112.7:1850:-15:00:34:47.8:116:27.7:H Ontario FSS
XIPL:Imperial:115.9:-20:-14:00:32:44.9:115:30.5:H San Diego FSS
XJLI:Julian:114.0:5560:-15:00:33:8.4:116:35.1:L San Diego FSS
XLHS:Lake Hughes:108.4:5790:-15:00:34:41:118:34.6:L Lancaster FSS
XLTA:Lake Tahoe:113.2:8850:-18:00:39:10.8:120:16.1:L Sacramento FSS tweb
XLIN:Linden:114.8:260:-17:00:38:04.5:121:00.2:H Sacramento FSS
XLAX:Los Angeles:113.6:180:-15:00:33:56:118:25.9:H Los Angeles FSS
XMRX:March AFB:113.4:0:-14:00:33:46.6:117:11.1:T Ontario FSS Military
XMYV:Marysville:110.8:0:-17:00:39:05.9:121:34.3:T Sacramento FSS
XMXW:Maxwell:110.0:110:-18:00:39:19.1:122:13.2:L Red Bluff FSS tweb
XMCC:McClellan AFB:109.2:76:-17:0:38:40:121:24.2:T Sacramento FSS Military
XENI:Mendocino:112.3:2980:-18:0:39:03.2:123:16.4:H Oakland FSS
XMCE:Merced:114.2:0:-17:00:37:13.2:120:24:L Fresno FSS
XMZB:Mission Bay:117.8:10:-15:00:32:46.9:117:13.5:H San Diego FSS tweb
XMOD:Modesto:114.6:90:-17:00:37:37.7:120:57.4:H Sacramento FSS
XEED:Needles:115.2:620:-14:0:34:46:114:28:H Las Vegas FSS
XOAK:Oakland:116.8:10:-17:00:37:43.6:122:13.4:H Oakland FSS
XOCN:Oceanside:115.3:90:-15:00:33:14.4:117:25:H San Diego FSS
XPSP:Palm Springs:115.5:1600:-15:00:33:52.2:116:25.7:L Thermal FSS
XPMD:Palmdale AFB:114.5:2500:-15:00:34:37.9:118:03.8:H Lancaster FSS Military
XPXN:Panoche:112.6:2060:-16:00:36:42.9:120:46.7:L Fresno FSS
XPDZ:Paradise:112.2:1430:-15:0:33:55.1:117:31.7:H Ontario FSS tweb
XPKE:Parker:117.9:1000:-15:00:34:06.1:114:40.9:H Ontario FSS
XPRB:Paso Robles:114.3:820:-16:00:35:40.3:120:37.6:L Paso Robles FSS tweb
XPGY:Poggi:109.8:580:-14:00:32:36.6:116:58.7:L San Diego No Voice
XPYE:Point Reyes:113.7:1340:-17:00:38:04.8:122:52:L Oakland FSS SFO ATIS
XPOM:Pomona:110.4:1270:-15:00:34:04.7:117:47.2:L Ontario FSS tweb
XPTV:Porterville:109.2:580:-16:00:35:54.8:119:01.2:L Frenso FSS
XROM:Priest:110.0:0:-16:00:36:08.4:120:39.8:L Paso Robles FSS
XRBL:Red Bluff:115.7:320:-18:00:40:06:122:14.1:H Red Bluff FSS tweb
XRAL:Riverside:112.4:0:-14:00:33:57.1:117:26.9:T Ontario FSS
XSAC:Sacramento:115.2:10:-17:00:38:26.6:121:33:H Sacramento FSS tweb
XSNS:Salinas:117.3:80:-7:00:36:39.8:121:36.1:H Salinas FSS tweb
XSFO:San Francisco:115.8:10:-17:00:37:37.2:122:22.4:L Oakland FSS SFO ATIS
XSJC:San Jose:114.1:50:-17:00:37:21.9:121:55.8:L Oakland FSS SJC ATIS
XSBP:San Luis Obispo:112.4:1462:-16:00:35:15.1:120:45.5:L Paso Robles FSS tweb
XSNA:Santa Ana:109.4:0:-15:00:33:41:117:51.7:T Ontario FSS No Voice
XSBA:Santa Barbara:114.9:3620:-16:00:34:30.6:119:46.2:H Santa Barbara FSS tweb
XSXC:Santa Catalina:111.4:2090:-15:00:33:22.5:118:25.1:L Los Angeles FSS tweb
XSMX:Santa Maria:111.0:0:-16:0:34:57.1:120:31.2:T Santa Barbara FSS tweb
XSMO:Santa Monica:110.8:115:-14:00:34:00.7:118:27.3:L Los Angeles FSS
XSTS:Santa Rosa:113.0:140:-18:00:38:30.5:122:48.6:L Oakland FSS
XSAU:Sausalito:116.2:1040:-17:00:37:51.3:122:31.3:L Oakland FSS tweb
XSLI:Seal Beach:115.7:20:-15:00:33:47:118:03.2:L Los Angeles FSS
XSIY:Siskiyou:110.8:0:-19:00:41:47.2:122:27.8:T Red Bluff FSS
XSGD:Scaggs Island:112.1:4:-17:00:38:10.8:122:22.3:L Oakland FSS
XSCK:Stockton:116.0:40:-17:00:37:50:121:10.2:H Stockton FSS tweb
XTRM:Thermal:116.2:-110:-15:00:33:37.7:116:09.6:H Thermal FSS No Voice
XSUU:Travis AFB:116.4:0:-17:00:38:20.7:121:48.6:L Sacramento FSS Military
XTNP:Twentynine Palms:114.2:1350:-15:00:34:06.7:115:46.1:L Thermal FSS
XVNY:Van Nuys:113.1:810:-15:00:34:13.4:118:29.5:L Los Angeles FSS VNY ATIS
XVTU:Ventura:108.2:1560:-15:00:34:06.9:119:02.9:L Santa Barbara FSS
XVIS:Visalia:109.4:260:-16:00:36:22:119:28.9:T Fresno FSS tweb
XILA:Williams:114.4:50:-18:00:39:04.3:122:01.6:L Sacramento FSS
XOSI:Woodside:113.9:2270:-17:00:37:23.5:122:16.8:L Oakland FSS
X#
X#       NEVADA VORS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		Name	VOR name, up to 32 chars
X#		Freq	VOR frequency
X#               Altitude        in feet for VOR/VORTAC VOR = 0 VORTAC != 0
X#		Variation	magnetic var. (+W-E) in degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X# Data taken from Flight Guide Volume I [15-june-85]
X#             and Airport / Facility Directory [26-sept-85]
X#
XBAM:Battle Mountain:112.2:4536:-18:00:40:34.2:116:55.3:H Elko FSS
XBTY:Beatty:114.7:2930:-16:00:36:48:116:44.8:H Las Vegas FSS tweb
XBLD:Boulder City:116.7:3650:-16:00:35:59.8:114:51.8:H Las Vegas FSS tweb
XBQU:Bullion:114.5:6460:-17:00:40:45.6:115:45.6:L Elko FSS
XOAL:Coaldale:117.7:4800:-17:00:38:00.2:117:46.2:H Reno FSS tweb
XELY:Ely:110.6:6250:-17:00:39:17.9:114:50.8:H Las Vegas FSS
XHZN:Hazen:114.1:4080:-17:00:39:31:118:59.8:L Reno FSS tweb
XLAS:Las Vegas:116.9:2140:-15:00:36:04.8:115:09.5:H Las Vegas FSS
XLOL:Lovelock:116.5:3900:-17:00:40:04:118:33.6:L Reno FSS tweb
XMVA:Mina:115.1:7860:-17:00:38:33.9:118:01.6:H Reno FSS tweb
XMMM:Mormon Mesa:114.3:2120:-16:00:36:46.2:144:16.6:L Las Vegas FSS
XNFL:Navy Fallon:113.5:0:-17:00:39:25:118:42.2: Military
XRNO:Reno:117.9:5940:-18:00:39:31.9:119:39.3:H Reno FSS tweb
XSDO:Sod House:114.3:4130:-18:00:41:24.6:118:01.92:L Reno FSS tweb
XTPH:Tonopah:117.2:5330:-18:00:38:01.9:117:02:L Reno FSS tweb
XLWL:Wells:114.2:0:-17:00:41:08.7:114:58.6:L Elko FSS
XILC:Wilson Creek:114.7:9318:-16:00:38:15:114:23.6:H Reno FSS
X#
X#       OREGON VORS
X#
X#	The fields in this file are in this order:
X#		ID	up to three letters, in caps
X#		Name	VOR name, up to 32 chars
X#		Freq	VOR frequency
X#               Altitude        in feet for VOR/VORTAC VOR = 0 VORTAC != 0
X#		Variation	magnetic var. (+W/-E) in degrees and minutes
X#		Latitude	north latitude, degrees and minutes
X#		Longitude	west longitude, degrees and minutes
X#		Comments	optional
X#
X#
X# Data taken from Flight Guide Volume I [15-june-85]
X#             and Airport / Facility Directory [25-oct-84]
X#
X# CVO Lat corrected 09-24-85
X# REO Lon corrected 10-19-85
X#
XAST:Astoria:114.0:10:-22:00:46:09.6:123:52.62:L Portland FSS
XBKE:Baker:115.3:3360:-20:00:44:50.5:117:48.5:H Boise FSS
XCVO:Corvallis:108.4:250:-21:00:44:30:123:17.5:L Portland FSS tweb
XEUG:Eugene:112.9:360:-20:00:44:07.2:123:13.3:H Portland FSS tweb
XIMB:Kimberly:115.6:5520:-20:00:44:38.9:119:42.6:H Redmond FSS tweb
XLMT:Klamath Falls:115.9:4087:-19:00:42:09.2:121:43.5:H Redmond FSS tweb
XLKV:LakeView:112.0:7460:-19:00:42:29.5:120:30.3:H Redmond FSS tweb
XOED:Medford:113.6:2080:-19:00:42:28.6:122:54.6:H North Bend FSS tweb
XUBG:Newburg:117.4:1440:-21:00:45:21.2:122:58.6:H Portland FSS tweb
XONP:Newport:117.1:150:-21:00:43:24.9:124:10:L North Bend FSS tweb
XOTH:North Bend:112.1:680:-20:00:43:24.9:124:10:L North Bend FSS tweb
XPDT:Pendleton:114.7:1556:-20:00:45:41.9::118:56.3:H Walla Walla FSS tweb
XPDX:Portland:116.6:250:-21:00:45:44.9:122:35.4:H Portland FSS tweb
XRDM:Redmond:117.6:4100:-20:00:44:15.2:121:18.2:H Redmond FSS
XREO:Rome:112.5:4050:-19:00:42:35.4:117:52:H Boise FSS tweb
XRBG:Roseburg:108.2:0:-19:00:43:10.9:123:21.1:Noth Bend FSS tweb
XDLS:The Dalles:112.3:3221:-21:00:45:42.2:122:58.6:H Portland FSS tweb
XILR:Wild Horse:113.8:0:-20:00:43:35.6:118:57.2:L Redmond FSS tweb
!E_O_F!