[r-cran-mapproj] 03/23: Import Upstream version 1.1-7

Andreas Tille tille at debian.org
Fri Sep 8 08:03:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-mapproj.

commit 55bc92cac25d714592b4febec5390919d9e7b135
Author: Andreas Tille <tille at debian.org>
Date:   Fri Sep 8 09:57:56 2017 +0200

    Import Upstream version 1.1-7
---
 DESCRIPTION                     |    5 +-
 man/mapproject.Rd               |   53 +-
 src/albers.c                    |    2 +-
 src/cuts.c                      |    4 +-
 src/doug/Makefile               |  127 ++++
 src/doug/README                 |  158 +++++
 src/doug/ascii2map              |   25 +
 src/doug/ascii2map1.c           |  192 ++++++
 src/doug/ascii2map2.c           |  106 ++++
 src/doug/ascii2map3.c           |   55 ++
 src/doug/doc/Makefile           |   16 +
 src/doug/doc/ascii2map.1        |   60 ++
 src/doug/doc/ascii2map.1.ps     |  258 ++++++++
 src/doug/doc/maint_record       |   48 ++
 src/doug/doc/map.1              |  720 ++++++++++++++++++++++
 src/doug/doc/map.1.ps           |  801 +++++++++++++++++++++++++
 src/doug/doc/map.3              |  151 +++++
 src/doug/doc/map.3.ps           |  396 ++++++++++++
 src/doug/doc/map.5              |   89 +++
 src/doug/doc/map.5.ps           |  299 +++++++++
 src/doug/doc/route.1            |   44 ++
 src/doug/doc/route.1.ps         |  255 ++++++++
 src/doug/doc/tmac.anx           |   18 +
 src/doug/index.c                |   96 +++
 src/doug/iplot.h                |   74 +++
 src/doug/libmap/Makefile        |   21 +
 src/doug/libmap/aitoff.c        |   31 +
 src/{ => doug/libmap}/albers.c  |    2 +-
 src/doug/libmap/azequalarea.c   |   24 +
 src/doug/libmap/azequidist.c    |   24 +
 src/doug/libmap/bicentric.c     |   30 +
 src/doug/libmap/bonne.c         |   41 ++
 src/doug/libmap/ccubrt.c        |   18 +
 src/doug/libmap/complex.c       |   89 +++
 src/doug/libmap/conic.c         |   32 +
 src/doug/libmap/cubrt.c         |   35 ++
 src/{ => doug/libmap}/cuts.c    |   15 +-
 src/doug/libmap/cylequalarea.c  |   29 +
 src/doug/libmap/cylindrical.c   |   24 +
 src/doug/libmap/eisenlohr.c     |   24 +
 src/doug/libmap/elco2.c         |  137 +++++
 src/doug/libmap/elliptic.c      |   42 ++
 src/doug/libmap/fisheye.c       |   31 +
 src/doug/libmap/gall.c          |   34 ++
 src/doug/libmap/gilbert.c       |   56 ++
 src/doug/libmap/guyou.c         |  106 ++++
 src/doug/libmap/harrison.c      |   45 ++
 src/doug/libmap/hex.c           |  128 ++++
 src/doug/libmap/homing.c        |  120 ++++
 src/doug/libmap/lagrange.c      |   35 ++
 src/{ => doug/libmap}/lambert.c |   19 +-
 src/doug/libmap/laue.c          |   29 +
 src/doug/libmap/lune.c          |   67 +++
 src/doug/libmap/mercator.c      |   41 ++
 src/doug/libmap/mollweide.c     |   30 +
 src/doug/libmap/newyorker.c     |   33 +
 src/doug/libmap/orthographic.c  |   40 ++
 src/doug/libmap/perspective.c   |   89 +++
 src/doug/libmap/polyconic.c     |   33 +
 src/doug/libmap/rectangular.c   |   27 +
 src/doug/libmap/simpleconic.c   |   39 ++
 src/doug/libmap/sinusoidal.c    |   22 +
 src/doug/libmap/tetra.c         |  214 +++++++
 src/doug/libmap/trapezoidal.c   |   35 ++
 src/doug/libmap/twocirc.c       |   85 +++
 src/doug/libmap/zcoord.c        |  149 +++++
 src/doug/map.c                  | 1265 +++++++++++++++++++++++++++++++++++++++
 src/doug/map.h                  |  156 +++++
 src/doug/map.sh                 |   71 +++
 src/doug/map.tar                |  Bin 0 -> 849920 bytes
 src/doug/mapdata/counties       |  Bin 0 -> 268024 bytes
 src/doug/mapdata/counties.x     |   16 +
 src/doug/mapdata/states         |  Bin 0 -> 47340 bytes
 src/doug/mapdata/states.x       |   16 +
 src/doug/mapdata/world          |  Bin 0 -> 246580 bytes
 src/doug/mapdata/world.x        |  348 +++++++++++
 src/doug/plot.h                 |   53 ++
 src/doug/plot0.c                |    8 +
 src/doug/plotPS.c               |  159 +++++
 src/doug/plotV.c                |   37 ++
 src/doug/route.c                |  107 ++++
 src/doug/symbol.c               |  195 ++++++
 src/doug/test.results           |   86 +++
 src/lambert.c                   |   11 +-
 src/mapproject.c                |    4 +-
 85 files changed, 8662 insertions(+), 47 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 24e2770..4e0ef7a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,9 +1,10 @@
 Package: mapproj
 Title: Map Projections
-Version: 1.1-6
-Date: 2004-03-10
+Version: 1.1-7
+Date: 2004-10-27
 Author: Doug McIlroy.  Packaged for R by Ray Brownrigg and Thomas P Minka.
 Description: Converts latitude/longitude into projected coordinates.
 Depends: maps
 License: Distribution and use for non-commercial purposes only.
 Maintainer: Thomas P Minka <surname at alum.mit.edu>
+Packaged: Wed Oct 27 17:28:33 2004; minka
diff --git a/man/mapproject.Rd b/man/mapproject.Rd
index 0694293..f404e99 100644
--- a/man/mapproject.Rd
+++ b/man/mapproject.Rd
@@ -22,9 +22,8 @@ north of the equator.
 }
 \item{projection}{
 optional character string that names a map projection to
-use.
-See below for a description of this and the
-next two arguments.
+use.  If the string is \code{""} then the previous projection is used,
+with parameters modified by the next two arguments.
 }
 \item{parameters}{
 optional numeric vector of parameters for use with the
@@ -37,10 +36,15 @@ must be given in the \code{parameters} argument.
 \item{orientation}{
   An optional vector \code{c(latitude,longitude,rotation)} which describes
   where the "North Pole" should be when computing the projection.
-  This is mainly used for specifying the point of tangency for a planar
-  projection; you should not use it for cylindrical or conic
-  projections.
-  The third value is a clockwise rotation (in degrees).
+  Normally this is \code{c(90,0)}, which is appropriate for 
+  cylindrical and conic projections.  For a planar projection, you should
+  set it to the desired point of tangency.
+  The third value is a clockwise rotation (in degrees), which defaults
+  to the midrange of the longitude coordinates in the map.
+  This means that two maps plotted with their own default orientation
+  may not line up.  To avoid this, you should not specify a projection
+  twice but rather default to the previous projection using
+  \code{projection=""}.  See the examples.
 }}
 \value{
 list with components
@@ -202,20 +206,23 @@ not make sense for tilted orientations.
 }
 } % end details
 \references{
-Richard A. Becker, and Allan R. Wilks,
-"Maps in S",
-\emph{AT\&T Bell Laboratories Statistics Research Report, 1991.}
-\url{http://www.research.att.com/areas/stat/doc/93.2.ps}
-
-M. D. McIlroy,
-documentation for
-from
-\emph{Tenth Edition UNIX Manual, Volume 1,}
-Saunders College Publishing, 1990.
-
-M. D. McIlroy,  Source code for maps and map projections.
-\url{http://www.cs.dartmouth.edu/~doug/source.html}
-%\url{http://cm.bell-labs.com/cs/who/doug/map.tar.gz}
+  Tom Minka, An overview of map projections.
+  \url{http://www.stat.cmu.edu/~minka/courses/36-315/handout/handout17.pdf}
+  
+  Richard A. Becker, and Allan R. Wilks,
+  "Maps in S",
+  \emph{AT\&T Bell Laboratories Statistics Research Report, 1991.}
+  \url{http://www.research.att.com/areas/stat/doc/93.2.ps}
+  
+  M. D. McIlroy,
+  documentation for
+  from
+  \emph{Tenth Edition UNIX Manual, Volume 1,}
+  Saunders College Publishing, 1990.
+
+  M. D. McIlroy,  Source code for maps and map projections.
+  \url{http://www.cs.dartmouth.edu/~doug/source.html}
+  %\url{http://cm.bell-labs.com/cs/who/doug/map.tar.gz}
 }
 \examples{
 library(maps)
@@ -224,6 +231,10 @@ map("state",proj='bonne', param=45)
 data(state)
 text(mapproject(state.center), state.abb)
 
+# this does not work because the default orientations are different:
+map("state",proj='bonne', param=45)
+text(mapproject(state.center,proj='bonne',param=45),state.abb)
+
 map("state",proj="albers",par=c(30,40))
 map("state",par=c(20,50)) # another Albers projection
 
diff --git a/src/albers.c b/src/albers.c
index fadbddc..795eae2 100644
--- a/src/albers.c
+++ b/src/albers.c
@@ -12,7 +12,7 @@ All rights reserved
 
 static double r0sq, r1sq, d2, n, den, sinb1, sinb2;
 static struct coord plat1, plat2;
-static southpole;
+static int southpole;
 
 static double num(double s)
 {
diff --git a/src/cuts.c b/src/cuts.c
index e3b8a19..4c395e8 100644
--- a/src/cuts.c
+++ b/src/cuts.c
@@ -22,7 +22,7 @@ are included to make the libary self-standing.*/
 int
 picut(struct place *g, struct place *og, double *cutlon)
 {
-	g; og; cutlon;
+	g=g; og=og; cutlon=cutlon;	/* avoid warnings */
 	abort();
 	return 0;
 }
@@ -30,7 +30,7 @@ picut(struct place *g, struct place *og, double *cutlon)
 int
 ckcut(struct place *g1, struct place *g2, double lon)
 {
-	g1; g2; lon;
+	g1=g1; g2=g2; lon=lon;
 	abort();
 	return 0;
 }
diff --git a/src/doug/Makefile b/src/doug/Makefile
new file mode 100644
index 0000000..3ba24d8
--- /dev/null
+++ b/src/doug/Makefile
@@ -0,0 +1,127 @@
+# /************************************************************
+#
+# Copyright (C) 1998, Lucent Technologies
+# All rights reserved
+#
+# ************************************************************/
+
+# local settings
+#
+# BIN		where to install map.sh ("map" command)
+# LIB		where to install libmap.a (ld ... -lmap)
+# MAPHOME	director of files used by map command
+# PROG		"map" in unix/linux; "map.exe" in cygwin
+#
+CFLAGS = -O -Wall
+CC=gcc
+BIN = /usr/bin
+LIB = /usr/lib
+MAPHOME = $(LIB)/map
+PROG = map
+
+# usage
+# make   	    map command compiled for PostScript output
+# make PLOT=plotV   for output to SVR2 and BSD plot filters
+# make PLOT=plot0   for output to v10 plot filters
+# make route	    see man page route.1
+
+
+PLOT=plotPS
+
+$(PROG): map.o index.o symbol.o $(PLOT).o libmap/libmap.a
+	chmod +x map.sh
+	$(CC) $(CFLAGS) -o $(PROG) -DMAPDIR=$(MAPDIR) \
+	    map.o index.o symbol.o $(PLOT).o \
+	    libmap/libmap.a -lm 2>/dev/null || \
+	$(CC) $(CFLAGS) -o $(PROG) -DMAPDIR=$(MAPDIR) \
+	    map.o index.o symbol.o $(PLOT).o \
+	    libmap/libmap.a -lm -lplot
+
+map.o: map.c map.h plot.h
+	$(CC) $(CFLAGS) -c $(CFLAGS) map.c
+
+plotV.o: plotV.c plot.h
+	rm -f plot*.o
+	$(CC) $(CFLAGS) -c plotV.c
+
+plotPS.o: plotPS.c plot.h
+	rm -f plot*.o
+	$(CC) $(CFLAGS) -c plotPS.c
+
+plot0.o: plot0.c
+	rm -f plot*.o
+	$(CC) $(CFLAGS) -c plot0.c
+
+symbol.o: symbol.c map.h
+
+index.o: index.c map.h
+
+route: route.o map.h libmap/libmap.a
+	$(CC) $(CFLAGS) route.o libmap/libmap.a -lm -o route
+
+libmap/libmap.a: dummy
+	cd libmap; make CC=$(CC) CFLAGS="$(CFLAGS)"
+
+dummy:
+	:
+
+ascii2map: ascii2map1 ascii2map2 ascii2map3
+	chmod +x ascii2map
+
+ascii2map1: ascii2map1.c
+	$(CC) $(CFLAGS) ascii2map1.c -lm -o ascii2map1
+
+ascii2map2: ascii2map2.c
+	$(CC) $(CFLAGS) ascii2map2.c -lm -o ascii2map2
+
+ascii2map3:	ascii2map3.c
+	$(CC) $(CFLAGS) ascii2map3.c -o ascii2map3
+
+map2ascii: map2ascii.c
+	$(CC) $(CFLAGS) map2ascii.c -lm -o map2ascii
+
+install: $(PROG)
+	-strip $(PROG)
+	test -d $(MAPHOME) || mkdir $(MAPHOME)
+	test -d $(MAPHOME)/bin || mkdir $(MAPHOME)/bin
+	test -d $(MAPHOME)/lib || mkdir $(MAPHOME)/lib
+	cp $(PROG) $(MAPHOME)/bin
+	cp map.sh $(BIN)/map
+	chmod +x $(BIN)/map
+	test -f $(MAPHOME)/lib/world || cp mapdata/* $(MAPHOME)/lib
+
+installall: install route libmap/libmap.a
+	strip route
+	cp route $(BIN)
+	cp libmap/libmap.a $(LIB)
+
+clean:
+	rm -f $(PROG) route *.o new.results map.tar*
+	cd libmap; make clean
+
+quicktest:
+	make PLOT=plotPS
+	MAPPROG=./$(PROG) MAPDIR=./mapdata ./map.sh mercator -l 0 10 0 10 -g -b >new.results
+	:
+	: If any "diff" output follows, it should show only roundoff differences.
+	diff test.results new.results
+
+map.tar.gz: dummy
+	cd doc; make
+	for i in map.sh Makefile; \
+		do mv $$i $$i.save; cp $$i.template $$i; \
+		done
+	tar cf map.tar \
+		README Makefile map.sh test.results \
+		map.h map.c index.c symbol.c \
+		plot.h iplot.h plotPS.c plotV.c plot0.c \
+		route.c ascii2map ascii2map[123].c \
+		libmap/Makefile libmap/*.c \
+		mapdata/world* mapdata/states* mapdata/counties* \
+		doc/*
+	for i in map.sh Makefile; \
+		do mv $$i.save $$i; \
+		done
+	rm -f map.tar.gz
+	gzip map.tar
+	echo >/dev/null
diff --git a/src/doug/README b/src/doug/README
new file mode 100644
index 0000000..ba3f10f
--- /dev/null
+++ b/src/doug/README
@@ -0,0 +1,158 @@
+# /************************************************************
+# 
+# Copyright (C) 1998, Lucent Technologies
+# All rights reserved
+# 
+# ************************************************************/
+# 
+MATERIALS
+
+The source directory has three subdirectories: 
+	doc		manual pages, maintenance record
+	libmap		source for projection subroutines
+	mapdata		World Data Bank I, etc.
+
+Manuals in doc are included in two forms.
+	input for troff -man:
+		map.1, map.3, map.5, route.1, mapfile.1
+	PostScript:
+		map.1.ps, ...
+
+A change history is in doc/maint_record.
+
+The source is written in ANSI C.
+
+QUICK TEST
+
+Check CFLAGS and CC in the Makefile and make them reflect your
+system's conventions.
+
+To see whether you can compile and compute, try this test, which
+makes "map", runs it on a small example, and checks the output:
+
+	make quicktest
+
+DISPLAY PROGRAMS
+
+Map produces output usable by a display program (not included).
+Unfortunately there is no universal Unix standard for plotting.
+
+Here are ways to compile for some display programs.
+"make quicktest" does a default make; undo that with
+"make clean" before doing a nondefault make.
+
+	make		default, same as make PLOT=plotPS
+
+	make PLOT=plotPS Output is PostScript.
+			Maps are drawn in a 6.5-inch square centered
+			1 inch from the top of an 8.5x11 page.
+			To change this convention, edit the PostScript
+			or plotPS.c.
+			One suitable plotting filter is ghostview,
+			sometimes known as gv(1).
+
+	make PLOT=plotV	Output for Sys V or SunOS plotting filters
+			described under plot(1) or tplot(1).
+
+	make PLOT=plot0	For v10 research system plot(1), not
+			compatible with System V.
+
+	As map uses only simple plotting features, it is usually
+	easy to interface to other plotting packages. See
+	iplot.h for details.
+
+You can test map in the current directory in the following way,
+assuming a Bourne-derived shell (sh, ksh, bash, ash, ...) and
+the PostScript display program gv.
+For further tests, replace mercator by any argument list
+from EXAMPLES on the man page map(1).
+
+	MAPDIR=./mapdata MAPPROG=./map map.sh mercator >junk.ps
+	gv junk.ps
+
+INSTALLATION
+
+For real installation, do
+
+	make install
+
+This puts the map shell script in /usr/bin and everything else in
+directory /usr/lib/map.  If you want to put things elsewhere, adjust
+MAPHOME in map.sh and the local settings in Makefile.
+
+map.sh will become the command "map".  Assuming it's in the
+shell search path after installation, and again assuming PostScript
+output, a map can be made and displayed thus:
+
+	map mercator >junk.ps; gv junk.ps
+
+TROUBLESHOOTING
+
+Lost output
+	If you lose the last bit of a map, read BUGS in map(1).
+
+Option problems
+	Option -f needs World Data Bank II, which is not in
+	this distribution, but can be fetched separately from
+	the same place.
+
+Library problems
+	At least one version of tplot has been seen to garble
+	the output.  In this case the trouble went away by
+	compiling map with -l4014 instead of -lplot; see plot(3).
+
+ROUTE PROGRAM
+
+An auxiliary "route" program computes the great circle route
+between two points, and can output either
+
+	1. An orientation (option -o) that transforms the great
+	circle to the equator, together with the coordinates
+	of the transformed endpoints.   A strip map extending
+	lat degrees on either side of the great circle between
+	the endpoints -lon and lon may be created thus:
+		map mercator -o o1 o2 o3 -w -lat lat -lon lon
+	Quantities obtained from "route" are the orientation
+	arguments o1, o2, o3.
+	
+	2. Coordinates for a track along the great circle,
+	suitable for use with options -t and -u.
+
+The program can be made with
+	
+	make route
+
+MAPFILE PROGRAMS
+
+Programs for converting between ASCII and binary map data
+formats are described in the man page mapfile(1).  They
+can be made with
+
+	make mapfile
+
+
+REFERENCES
+
+Most standard texts on cartography discuss the major 
+projections and their uses.  A short introduction, with
+24 sample maps drawn by the "map" program itself and the
+commands to draw them, is
+
+	Projections: Mapmakers' Answers to the Riddle of
+	Presenting a Round Earth on Flat Paper
+	by M. Douglas McIlroy
+	Computing Science Technical Report 140, (1987)
+
+	available from
+	Computing Science Reports, Room 2C447
+	Bell Labs
+	600 Mountain Avenue
+	Murray Hill, NJ 07974
+
+	[In this report, option -s is used in an obsolete way.
+	It should be replaced by -s2, with -s1 added
+	to the previous command.]
+
+Doug McIlroy
+doug at cs.dartmouth.edu
+
diff --git a/src/doug/ascii2map b/src/doug/ascii2map
new file mode 100755
index 0000000..bf11323
--- /dev/null
+++ b/src/doug/ascii2map
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# convert an ascii file on standard input containing geographic
+# line features (shorelines, rivers, political boundaries, etc) 
+# into map(5) form usable by map(1)
+#
+# usage: ascii2map [-f] ofile
+#
+# input: sequence of segments, each made of
+#	integer count (n)
+#	n coordinate pairs, decimal degrees (lat N and lon W)
+#
+# two output files:
+#	ofile		the binary data
+#	ofile.x		ascii index to 10-degree patches in ofile
+#
+# option -f produces finer resolution 
+
+if test ${1}x = "-fx"
+then F=-f; shift
+else F=
+fi
+
+./ascii2map1 $F | sort -n -k1 -k2 -k3 | ./ascii2map2 $F >$1
+./ascii2map3 <$1 >$1.x
diff --git a/src/doug/ascii2map1.c b/src/doug/ascii2map1.c
new file mode 100644
index 0000000..230ee5d
--- /dev/null
+++ b/src/doug/ascii2map1.c
@@ -0,0 +1,192 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <limits.h>
+
+/* convert an ascii file of lat-lon data to map(5) format,
+
+   input: sequence of segments, each of which comprises
+		integer count
+		sequence of north-lat west-lon pairs
+
+   first phase (mapfile1.c): make intermediate file
+   intermediate data layout, one line per point:
+	patchlat (-9 to 8)	10-degree patch in which 
+	patchlon (-18 to 17)	    segment starts
+	point number		sequential, with gap between segs
+	scaled lat		units of .0001 radian (6.4km, 4mi)
+	scaled lon		    or .00001 radian (option -f)
+
+   interphase: sort the intermediate file by patch and point number
+
+   second phase (mapfile2.c): convert to map(5) binary
+
+   warning: incomplete error checking.
+*/
+
+/* FIRST PHASE */
+
+#define RAD (M_PI/180)
+#define SCALE (10000*RAD)
+#define BIGSCALE (100000*RAD)
+#define NN SHRT_MAX	/* max points/segment */
+#define N (NN-1000)	/* same, before interpolation */
+
+int min(int,int);
+int max(int,int);
+int plat(int);
+int plon(int);
+int interpolate(int,int);
+double round(double);
+void output(int);
+void warn(char*);
+void error(char*);
+
+int point;		/* sequence number */
+double lat[N];
+double lon[N];
+double scale = SCALE;
+
+int main(int argc, char **argv)
+{
+	int i, j, n;
+	int fflag = 0;
+	if(argc>1 && strcmp(argv[1],"-f")==0) {
+		fflag = 1;
+		scale = BIGSCALE;
+	}
+	while(scanf("%d", &n) == 1) {
+		i = 0;
+		do {
+			int m = min(n,N);
+			n -= m;
+			for( ; i<m; i++) {
+				if(scanf("%lf %lf",lat+i,lon+i) != 2)
+					error("input count error");
+				if(fabs(lat[i]) > 90)
+					error("latitude out of bounds");
+				while(lon[i] < -180)
+					lon[i] += 360;
+				while(lon[i] > 180)
+					lon[i] -= 360;
+			}
+			if(fflag) {
+				for(j=0; j<m-1; j++) {
+					int d = interpolate(j, m);
+					j += d;
+					m += d;
+				}
+			}
+			do {
+				for(j=2;j<m-1;j++)
+					if(plat(j)!=plat(j-1) ||
+					   plon(j)!=plon(j-1)) 
+					 	break;
+				if(m < 3)
+					j = m-1;
+				output(j+1);
+				memmove(lat,lat+j,(m-j)*sizeof(*lat));
+				memmove(lon,lon+j,(m-j)*sizeof(*lon));
+				m -= j;
+			} while(m > 1);
+			i = 1;
+		} while(n > 1);
+	}
+	return 0;
+}
+
+/* find patch number, counted in 10-degree units */
+
+int plat(int i)
+{
+	return min(floor(lat[i]/10),8);
+}
+
+int plon(int i)
+{
+	return min(floor(lon[i]/10),17);
+}
+
+/* split large steps to fit in a char */
+
+#define DELTA (SCHAR_MAX-1)	/* wiggle room for roundoff */
+
+int interpolate(int j, int n)
+{
+	int m, mlat, mlon;	/* number of substeps */
+	int from, to;
+	double dlat, dlon;
+	double slat0 = round(lat[j]*scale);
+	double slat1 = round(lat[j+1]*scale);
+	double slon0 = round(lon[j]*scale);
+	double slon1 = round(lon[j+1]*scale);
+	int sdlat = abs(slat1-slat0);
+	int sdlon = abs(slon1-slon0);
+	if(sdlon > 180)
+		sdlon -= 360;	/* probably crossed dateline */
+	mlat = (sdlat+DELTA-1)/DELTA; 
+	mlon = (sdlon+DELTA-1)/DELTA;
+	m = max(mlat, mlon) - 1;	/* # of extra points */
+	if(m == 0)
+		return 0;
+	if(m >= 10)
+		warn("long segment (> 10 substeps)");
+	if(n+m > NN)
+		error("too many interpolated points in segment");
+	from = j + 1;
+	to = j + m;
+	memmove(lat+to,lat+from,(n-from)*sizeof(*lat));
+	memmove(lon+to,lon+from,(n-from)*sizeof(*lon));
+	dlat = lat[j+1] - lat[j];
+	dlon = lon[j+1] - lon[j];
+	while(j < m) {
+		lat[j+1] = lat[j] + dlat;
+		lon[j+1] = lon[j] + dlon;
+		j++;
+	}
+	return m;
+}
+
+void output(int n)
+{
+	int i;
+	int plat0 = plat(n>1);
+	int plon0 = plon(n>1);
+	point++;
+	for(i=0; i<n; i++) {
+		printf("%d %d %d %d %d\n",plat0,plon0,point,
+			(int)round(lat[i]*scale),
+			(int)round(lon[i]*scale));
+		point++;
+	}
+}
+
+int min(int a, int b)
+{
+	return a<=b? a: b;
+}
+
+int max(int a, int b)
+{
+	return a>=b? a: b;
+}
+
+void warn(char *s) 
+{
+	fprintf(stderr,"ascii2map: %s\n", s);
+}
+
+void error(char *s) 
+{
+	warn(s);
+	exit(1);
+}
+
+double round(double x)
+{
+	if(x >= 0)
+		return (int)(x+0.5);
+	else
+		return (int)(x-0.5);
+}
diff --git a/src/doug/ascii2map2.c b/src/doug/ascii2map2.c
new file mode 100644
index 0000000..6352ba9
--- /dev/null
+++ b/src/doug/ascii2map2.c
@@ -0,0 +1,106 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <limits.h>
+#include <unistd.h>
+
+/* convert an ascii file of lat-lon data to map(5) format,
+
+   input: sequence of segments, each of which comprises
+		integer count
+		sequence of north-lat west-lon pairs
+
+   first phase (mapfile1.c): make intermediate file
+   intermediate data layout, one line per point:
+	patchlat (-9 to 8)	10-degree patch in which 
+	patchlon (-18 to 17)	    segment starts
+	point number		sequential, with gap between segs
+	scaled lat		units of .0001 radian (6.4km, 4mi)
+	scaled lon		    or .00001 radian (option -f)
+
+   interphase: sort the intermediate file by patch and point number
+
+   second phase (mapfile2.c): convert to map(5) binary
+
+   warning: incomplete error checking.
+*/
+
+/* SECOND PHASE */
+
+#define N 32000		/* max points per segment (must fit in signed short) */
+
+
+void error(char*);
+void putshort(int);
+void output(int);
+
+int fflag = 0;
+
+int plat0, plon0;
+int ilat[N+1], ilon[N+1]; 
+
+int main(int argc, char**argv)
+{
+	int n = 0;
+	int point;
+	int point0 = -1;
+	int plat, plon;
+	fflag = argc>1 && strcmp(argv[1],"-f")==0;
+	plat0 = plon0 = INT_MIN;
+	while(scanf("%d %d %d %d %d",
+	      &plat, &plon ,&point, ilat+n, ilon+n) == 5) {
+		if(point != point0+1) {
+			output(n);
+			ilat[0] = ilat[n];
+			ilon[0] = ilon[n];
+			n = 1;
+		} else
+			n++;
+		point0 = point;
+		plat0 = plat;
+		plon0 = plon;
+	}
+	output(n);
+	return 0;		
+}
+
+void output(int n)
+{
+	int i;
+	if(n == 0)
+		return;
+	putchar(plat0&0xff);
+	putchar(plon0&0xff);
+	if(fflag) {
+		int ilat0 = ilat[0]/10;
+		int ilon0 = ilon[0]/10;
+		putshort(-n);
+		putshort(ilat0);
+		putshort(ilon0);
+		putchar(ilat[0]-ilat0*10);
+		putchar(ilon[0]-ilon0*10);
+		for(i=1; i<n; i++) {
+			putchar(ilat[i]-ilat[i-1]);
+			putchar(ilon[i]-ilon[i-1]);
+		}
+	} else {
+		putshort(n);
+		for(i=0; i<n; i++) {
+			putshort(ilat[i]);
+			putshort(ilon[i]);
+		}
+	}
+}
+
+void error(char *s) 
+{
+	fprintf(stderr,"ascii2map2: %s\n", s);
+	exit(1);
+}
+
+void putshort(int x)
+{
+	putchar(x&0xff);
+	putchar(x>>8&0xff);
+}
diff --git a/src/doug/ascii2map3.c b/src/doug/ascii2map3.c
new file mode 100644
index 0000000..512a0a0
--- /dev/null
+++ b/src/doug/ascii2map3.c
@@ -0,0 +1,55 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+short getshort(void);
+void error(char*);
+
+int main()
+{
+	int i,j, n;
+	int oi = 127, oj = 127;
+	long loc = 0;
+	while((i=getchar()) != EOF) {
+		j = getchar();
+		n = getshort();
+		if(i!= oi||j!=oj) {
+			printf("%d %d %ld\n",(char)i,(char)j,loc);
+			oi = i;
+			oj = j;
+		}
+		loc += 4;
+		if(n > 0) {
+			while(--n >= 0) {
+				getshort();
+				getshort();
+				loc += 4;
+			}
+		} else {
+			getshort();
+			getshort();
+			loc += 4;
+			while(++n <= 0) {
+				getchar();
+				getchar();
+				loc += 2;
+			}
+		}
+	}
+	return 0;
+}
+
+short getshort(void)
+{
+	int c = getchar();
+	int d = getchar();
+	if(c==EOF || d==EOF) 
+		error("premature eof");
+	return c | d<<8;
+}
+
+void error(char *s)
+{
+	fflush(stdout);
+	fprintf(stderr,"ascii2map3: %s\n", s);
+	exit(1);
+}
diff --git a/src/doug/doc/Makefile b/src/doug/doc/Makefile
new file mode 100644
index 0000000..ba78eec
--- /dev/null
+++ b/src/doug/doc/Makefile
@@ -0,0 +1,16 @@
+all: map.1.ps map.3.ps map.5.ps route.1.ps ascii2map.1.ps
+
+map.1.ps: map.1
+	groff -man map.1 >map.1.ps
+
+map.3.ps: map.3
+	groff -man map.3 >map.3.ps
+
+map.5.ps: map.5
+	groff -man map.5 >map.5.ps
+
+route.1.ps: route.1
+	groff -man route.1 >route.1.ps
+
+ascii2map.1.ps: ascii2map.1
+	groff -man ascii2map.1 >ascii2map.1.ps
diff --git a/src/doug/doc/ascii2map.1 b/src/doug/doc/ascii2map.1
new file mode 100644
index 0000000..a6c6ce7
--- /dev/null
+++ b/src/doug/doc/ascii2map.1
@@ -0,0 +1,60 @@
+.TH ASCII2MAP 1
+.SH NAME
+ascii2map, map2ascii \- map data conversion
+.SH SYNOPSIS
+.B ascii2map
+[
+.B -f
+]
+.I mapfile
+.br
+.B map2ascii 
+.I "lat lon
+[
+.I mapfile
+[
+.I index
+]]
+.SH DESCRIPTION
+.I Ascii2map
+creates a
+.IR map(5)
+file named
+.I mapfile,
+and an associated index
+.IB mapfile .x , 
+from latitude-longitude data on standard input.
+Resolution in
+.I mapfile
+is .0001 radian by default and .00001 radian under option
+.BR -f .
+.PP
+The input data is a sequence of connected segements,
+each of which is represented as a decimal count,
+.I n,
+followed by
+.I n
+decimal latitude-longitude pairs, where west longitude
+is positive.
+.PP
+.I Map2ascii
+converts all the segments in one 10-degree patch of the
+.I mapfile
+.RB (default /usr/dict/world )
+into
+.I ascii2map
+input format.
+.I Lat
+and
+.I lon
+are multiples of 10, the minimum coordinates
+of the patch.
+If no 
+.I index 
+is specified,
+.IB mapfile .x
+is understood.
+.SH "SEE ALSO
+.IR map (5),
+.IR map (1)
+
diff --git a/src/doug/doc/ascii2map.1.ps b/src/doug/doc/ascii2map.1.ps
new file mode 100644
index 0000000..a4ba6fa
--- /dev/null
+++ b/src/doug/doc/ascii2map.1.ps
@@ -0,0 +1,258 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Sat Mar 20 07:21:36 2004
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 1
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic at 0 ENC0/Times-Italic RE/Times-Bold at 0 ENC0/Times-Bold RE
+/Times-Roman at 0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 336.62
+<4153434949324d4150283129204153434949324d4150283129>72 48 R/F1 10.95
+/Times-Bold at 0 SF -.219<4e41>72 84 S<4d45>.219 E F0
+<6173636969326d61702c206d617032617363696920ad206d6170206461746120636f6e>
+108 96 Q -.15<7665>-.4 G<7273696f6e>.15 E F1<53594e4f50534953>72 112.8 Q
+/F2 10/Times-Bold at 0 SF<6173636969326d6170>108 124.8 Q F0<5b>2.5 E F2
+<2d66>2.5 E F0<5d>2.5 E/F3 10/Times-Italic at 0 SF<6d61708c6c65>2.88 E F2
+<6d6170326173636969>108 136.8 Q F3<6c6174206c6f6e>2.59 E F0<5b>2.74 E F3
+<6d61708c6c65>2.88 E F0<5b>2.68 E F3<696e6465>2.51 E<78>-.2 E F0<5d5d>
+3.03 E F1<4445534352495054494f4e>72 153.6 Q F3<4173636969326d6170>109.01
+165.6 Q F0 .43<637265617465732061>3.12 F F3<6d6170283529>2.93 E F0 .429
+<8c6c65206e616d6564>2.929 F F3<6d61708c6c65>3.309 E<2c>-.1 E F0 .429
+<616e6420616e206173736f63696174656420696e6465>2.929 F<78>-.15 E F3
+<6d61708c6c65>2.929 E F2<2e78>.18 E F3<2c>.54 E F0 .429
+<66726f6d206c617469747564652d6c6f6e676974756465>2.929 F
+<64617461206f6e207374616e6461726420696e7075742e>108 177.6 Q
+<5265736f6c7574696f6e20696e>5 E F3<6d61708c6c65>2.88 E F0
+<6973202e303030312072616469616e20627920646566>2.68 E
+<61756c7420616e64202e30303030312072616469616e20756e646572206f7074696f6e>
+-.1 E F2<2d66>2.5 E F0<2e>A .707<54686520696e70757420646174612069732061
+2073657175656e6365206f6620636f6e6e6563746564207365>108 194.4 R .707<6765
+6d656e74732c2065616368206f6620776869636820697320726570726573656e74656420
+6173206120646563696d616c20636f756e742c>-.15 F F3<6e2c>3.568 E F0
+<666f6c6c6f>108 206.4 Q<776564206279>-.25 E F3<6e>2.86 E F0<646563696d61
+6c206c617469747564652d6c6f6e6769747564652070616972732c207768657265207765
+7374206c6f6e67697475646520697320706f73697469>2.74 E -.15<7665>-.25 G<2e>
+.15 E F3<4d6170326173636969>108.68 223.2 Q F0<636f6e>4.109 E -.15<7665>
+-.4 G 1.249<72747320616c6c20746865207365>.15 F 1.249
+<676d656e747320696e206f6e652031302d6465>-.15 F 1.248
+<67726565207061746368206f6620746865>-.15 F F3<6d61708c6c65>4.128 E F0
+<28646566>3.928 E<61756c74>-.1 E F2<2f7573722f646963742f77>A<6f726c64>
+-.1 E F0 3.748<2969>C<6e746f>-3.748 E F3<6173636969326d6170>108.33 235.2
+Q F0 1.302<696e70757420666f726d61742e>3.992 F F3<4c6174>6.882 E F0
+<616e64>4.482 E F3<6c6f6e>3.892 E F0 1.302<617265206d756c7469706c657320
+6f662031302c20746865206d696e696d756d20636f6f7264696e61746573206f66207468
+652070617463682e>4.042 F 1.303<4966206e6f>6.303 F F3<696e6465>108.01
+247.2 Q<78>-.2 E F0<69732073706563698c65642c>3.03 E F3<6d61708c6c65>2.5
+E F2<2e78>.18 E F0<697320756e64657273746f6f642e>2.5 E F1
+<53454520414c534f>72 264 Q F3<6d6170>108 276 Q F0<2835292c>.19 E F3
+<6d6170>2.5 E F0<283129>.19 E<31>535 768 Q 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/src/doug/doc/maint_record b/src/doug/doc/maint_record
new file mode 100644
index 0000000..e23582f
--- /dev/null
+++ b/src/doug/doc/maint_record
@@ -0,0 +1,48 @@
+Mar 30,2004
+    map.c, map.1
+	diagnostics include a version identifier.
+Mar 19,2004
+    lambert.c
+	Correct erroneous limit when standard parallels coincide.
+	Problem noted by alex.deckmyn at oma.be.  Reject the limiting
+	case of both standard parallels approaching the south pole.
+	(Not easy to do right in the existing libmap framework.)
+Dec 17, 2003
+    ascii2map, map2ascii
+	Add programs for converting between binary and ASCII map data.
+        Make corresponding changes to manual, makefile, and README.
+Nov 13, 2003
+    man pages 
+	A Makefile in the doc subdirectory supplies some extra 
+	macro definitions beyond the usual -man macros.  This
+	trades away prettiness for robustness--assuming you have
+	groff.
+Oct 16 2003
+    map.c
+	Option -b: check that next argument exists before trying to
+	look at it.  Stop accepting -b 0 as synonym for naked -b.
+    eisenlohr.c
+	New projection.
+    zcoord.c, homing.c, map.h
+	Make trigclamp() global in zcoord.c rather than static
+	in homing.c.
+    zcoord.c, elliptic.c
+	Apply trigclamp() to defend against sin and cos outside [-1,1].
+	Problem noted by minka at stat.cmu.edu.
+    map.h, map.c, symbol.c, zcoord.c, aitoff.c, gilbert.c, hex.c, homing.c
+	Rename sincos as trig to avoid collision with nonstandard
+	but ubiquitous math-library function.
+    hex.c, tetra.c
+	Fix initialization to make projections serially reusable.
+	Problem noted by minka at stat.cmu.edu.
+    Makefile, map.sh, map.c
+	Rework macro and environment names for consistency and simplicity.
+    Makefile
+	Some simplification and robustification.
+    README
+	Revisions for clarity and currency with other changes.
+	Correct the usage of gv.
+	Describe the "route" program.
+    map.1
+	Add eisenlohr; delete duplicate description of gilbert.
+
diff --git a/src/doug/doc/map.1 b/src/doug/doc/map.1
new file mode 100644
index 0000000..dba8410
--- /dev/null
+++ b/src/doug/doc/map.1
@@ -0,0 +1,720 @@
+.so tmac.anx
+.TH MAP 1
+.SH NAME
+map \- draw maps on various projections
+.SH SYNOPSIS
+.B map
+.I projection
+[
+.I option ...
+]
+.SH DESCRIPTION
+.I Map
+prepares on the standard output a
+map suitable for display in PostScript.
+By default, maps are scaled to fit in a 6.5-inch square
+centered 1 inch from the top of an 8.5\(mu11-inch page.
+.PP
+The default data for
+.I map
+are world shorelines.
+Option
+.B -f
+accesses more detailed data
+classified by feature.
+.TP
+.BR -f " [ \fIfeature\fR ... ]"
+Features are ranked 1 (default) to 4 from major to minor.
+Higher-numbered ranks include all lower-numbered ones.
+Features are
+.RS
+.PD 0
+.TF country[1-3]
+.TP
+.BR shore [ 1 - 4 ] 
+seacoasts, lakes, and islands; option
+.B -f
+always shows
+.B shore1
+.TP
+.BR ilake [ 1 - 2 ] 
+intermittent lakes
+.TP
+.BR river [ 1 - 4 ] 
+rivers
+.TP
+.BR iriver [ 1 - 3 ] 
+intermittent rivers
+.TP
+.BR canal [ 1 - 3 ] 
+.BR 3 =irrigation
+canals
+.TP
+.BR glacier
+.TP
+.BR iceshelf [ 12 ] 
+.TP
+.BR reef
+.TP
+.BR saltpan [ 12 ] 
+.TP
+.BR country [ 1 - 3 ] 
+.BR 2 =disputed
+boundaries,
+.BR 3 =indefinite
+boundaries
+.TP
+.BR state
+states and provinces (US and Canada only)
+.RE
+.PD
+.PP
+In other options
+coordinates are in degrees, with north latitude
+and west longitude counted as positive.
+.TP 5n
+.BI -l " S N E W"
+Set the southern and northern latitude
+and the eastern and western longitude limits.
+Missing arguments are filled out from the list
+\-90, 90, \-180, 180,
+or lesser limits suitable to the
+projection at hand.
+.TP
+.BI -k " S N E W
+Set the scale as if for a map with limits
+.B -l
+.I "S N E W"\f1.
+Do not consider any
+.B -l
+or
+.B -w
+option in setting scale.
+.TP
+.BI -o " lat lon rot"
+Orient the map in a nonstandard position.
+Imagine a transparent gridded sphere around the globe.
+Turn the overlay about the North Pole
+so that the Prime Meridian (longitude 0)
+of the overlay coincides with meridian
+.I lon
+on the globe.
+Then tilt the North Pole of the
+overlay along its Prime Meridian to latitude
+.I lat
+on the globe.
+Finally again turn the
+overlay about its `North Pole' so
+that its Prime Meridian coincides with the previous position
+of meridian
+.IR rot .
+Project the map in
+the standard form appropriate to the overlay, but presenting
+information from the underlying globe.
+Missing arguments are filled out from the list
+90, 0, 0.
+In the absence of
+.BR - o ,
+the orientation is 90, 0,
+.IR m ,
+where
+.I m
+is the middle of the longitude range.
+.TP
+.BI -w " S N E W"
+Window the map by the specified latitudes
+and longitudes in the tilted, rotated coordinate system.
+Missing arguments are filled out from the list \-90, 90, \-180, 180.
+(It is wise to give an encompassing
+.B -l
+option with
+.BR -w .
+Otherwise for small windows computing time
+varies inversely with area!)
+.TP
+.BI -d " n"
+For speed, plot only every
+.IR n th
+point.
+.TP
+.B  -r
+Reverse left and right
+(good for star charts and inside-out views).
+.ns
+.TP
+.B -v
+Verso.
+Switch to a normally suppressed sheet of the map, such as the
+back side of the earth in orthographic projection.
+.TP
+.B  -s1
+.br
+.ns
+.TP
+.B -s2
+Superpose; outputs for a
+.B -s1
+map (no closing) and a
+.B -s2
+map (no opening) may be concatenated.
+.TP
+.BI -g " dlat dlon res"
+Grid spacings are
+.IR dlat ,
+.IR dlon .
+Zero spacing means no grid.
+Missing
+.I dlat
+is taken to be zero.
+Missing
+.I dlon
+is taken the same as
+.IR dlat .
+Grid lines are drawn to a resolution of
+.I res
+(adaptively determined by default).
+In the absence of
+.BR - g ,
+grid spacing is 10.
+.TP
+.BI -p " lat lon extent"
+Position the point
+.I lat, lon
+at the center of the plotting area.
+Scale the map so that the height (and width) of the
+nominal plotting area is
+.I extent
+times the size of one degree of latitude
+at the center.
+By default maps are scaled and positioned
+to fit within the plotting area.
+An
+.I extent
+overrides option
+.BR -k .
+.TP
+.BI -c " x y rot"
+After all other positioning and scaling operations
+have been performed, rotate the image
+.I rot
+degrees counterclockwise about the center 
+and move the center to position
+.IR x ,
+.IR y 
+in the nominal plotting area, whose coordinates
+run from \-1 to 1.
+Missing arguments are taken to be 0.
+.TP
+.BR -x
+Allow the map to extend outside the nominal plotting area.
+.TP
+.BR -m " [ \fIfile\fP ... ]"
+Use
+map data from named files.
+If no files are named, omit map data.
+Names that do not exist as pathnames are looked up in
+a standard directory, which contains, in addition to the
+data for
+.BR -f ,
+.RS
+.PD 0
+.TF counties
+.TP
+.B world
+World Data Bank I (default)
+.TP
+.B states
+US map from Census Bureau
+.TP
+.B counties
+US map from Census Bureau
+.RE
+.PD
+.IP
+The environment variable
+.B MAPDIR 
+changes the standard directory.
+.TP
+.BI -b " \fR[\fPlat0 lon0 lat1 lon1\fR... ]"
+Suppress the drawing of the normal boundary
+(determined by the projection and options
+.BR -l 
+and
+.BR -w ).
+Coordinates, if present, define the vertices of a
+polygon to which the map is clipped.
+If only two vertices are given, they are taken to be the
+diagonal of a rectangle.
+To draw the polygon, give its vertices as a
+.B -u
+track.
+.TP
+.BI -t " file ..."
+The
+.I files
+contain lists of points,
+given as latitude-longitude pairs in degrees.
+If the first file is named 
+.LR \- ,
+the standard input is taken instead.
+The points of each list are connected by dot-dash tracks.
+.IP
+Points in a track file may be followed by label strings.
+A label breaks the track.
+A label may be prefixed by
+\fB"\fR,
+.LR : ,
+or 
+.L !
+and is terminated by a newline.
+An unprefixed string or a string prefixed with
+.L
+"
+is displayed at the designated point.
+The first word of a
+.B :
+or
+.B !
+string names a special symbol (see option
+.BR -y ).
+An optional numerical second word is a scale factor
+for the size of the symbol, 1 by default.
+A
+.B :
+symbol is aligned with its top to the north; a
+.B !
+symbol is aligned vertically on the page.
+.TP
+.BI -u " file ..."
+Same as
+.BR -t ,
+except the tracks are
+unbroken lines.
+.TP
+.BI -C " color
+Set color (initially black).  At each of the options
+.BR -b ,
+.BR -g ,
+.BR -m ,
+.BR -t ,
+and
+.BR -u
+the most recently set color is remembered and used to draw the
+associated data.  The 
+.I color
+is one of 
+.BR black ,
+.BR red ,
+.BR green ,
+.BR blue ,
+or a PostScript HSB code, such as 
+.LR .33,.5,1 
+(a bright light greeen).
+The numbers range from 0 to 1 for
+hue (red to violet), saturation
+(unsaturated to full) and brightness (off to full).
+.TP
+.BI -y " file
+The
+.I file
+describes a plotting symbol as a sequence of
+strokes.  A normal-size symbol has coordinates
+running from \-1 to 1.
+Location (0,0) falls on the plotting point when
+a symbol is placed by
+.B :
+or
+.B !
+in a track.  (See option
+.BR -t .)
+The file contains lines of the following forms.
+.RS
+.PD 0
+.TF m\ name
+.TP
+.BI : " name
+name of symbol, must come first
+.TP
+.BI m " x y
+move to given point
+.TP
+.BI v " x y
+draw vector from previous point to here
+.RE
+.PD
+.SS Projections
+.rs
+.PP
+A menu of projections is produced in response to an unknown
+.IR projection .
+.br
+.PP
+Equatorial projections centered on the Prime Meridian
+(longitude 0).
+Parallels are straight horizontal lines.
+.PP
+.PD 0
+.TP 1.5i
+.B mercator
+equally spaced straight meridians, conformal,
+straight compass courses
+.TP
+.B sinusoidal
+equally spaced parallels,
+equal-area, same as
+.LR "bonne 0" .
+.TP
+.BI cylequalarea " lat0"
+equally spaced straight meridians, equal-area,
+true scale on
+.I lat0
+.TP
+.B cylindrical
+central projection on tangent cylinder
+.TP
+.BI rectangular " lat0"
+equally spaced parallels, equally spaced straight meridians, true scale on
+.I lat0
+.TP
+.BI gall " lat0"
+parallels spaced stereographically on prime meridian, equally spaced straight
+meridians, true scale on
+.I lat0
+.TP
+.B mollweide
+(homalographic) equal-area, hemisphere is a circle
+.TP
+.B gilbert
+globe mapped conformally on hemisphere, viewed orthographically
+.PD
+.br
+.PP
+Azimuthal projections centered on the North Pole.
+Parallels are concentric circles.
+Meridians are equally spaced radial lines.
+.PP
+.PD 0
+.TP 1.5i
+.B azequidistant
+equally spaced parallels,
+true distances from pole
+.TP
+.B azequalarea
+equal-area
+.TP
+.B gnomonic
+central projection on tangent plane,
+straight great circles
+.TP
+.BI perspective " dist"
+viewed along earth's axis
+.I dist
+earth radii from center of earth
+.TP
+.B orthographic
+viewed from infinity
+.TP
+.B stereographic
+conformal, projected from opposite pole
+.TP
+.B laue
+.IR radius " = tan(2\(mu" colatitude ),
+used in X-ray crystallography
+.TP
+.BI fisheye " n"
+stereographic seen from just inside medium with refractive index
+.I n
+.TP
+.BI newyorker " r"
+.IR radius " = log(" colatitude / r ):
+.I New Yorker
+map from viewing pedestal of radius
+.I r
+degrees
+.PD
+.br
+.PP
+Polar conic projections symmetric about the Prime Meridian.
+Parallels are segments of concentric circles.
+Except in the Bonne projection,
+meridians are equally spaced radial
+lines orthogonal to the parallels.
+.PP
+.PD 0
+.TP 1.5i
+.BI conic " lat0"
+central projection on cone tangent at
+.I lat0
+.TP
+.BI simpleconic " lat0 lat1"
+equally spaced parallels, true scale on
+.I lat0
+and
+.I lat1
+.TP
+.BI lambert " lat0 lat1"
+conformal, true scale on 
+.I lat0
+and 
+.I lat1
+.TP
+.BI albers " lat0 lat1"
+equal-area, true scale on
+.I lat0
+and 
+.I lat1
+.TP
+.BI bonne " lat0"
+equally spaced parallels, equal-area,
+parallel
+.I lat0
+developed from tangent cone
+.PD
+.br
+.br
+.PP
+Projections with bilateral symmetry about
+the Prime Meridian
+and the equator.
+.PP
+.PD 0
+.TP 1.5i
+.B polyconic
+parallels developed from tangent cones,
+equally spaced along Prime Meridian
+.TP
+.B aitoff
+equal-area projection of globe onto 2-to-1
+ellipse, based on 
+.I azequalarea
+.TP
+.B lagrange
+conformal, maps whole sphere into a circle
+.TP
+.BI bicentric " lon0"
+points plotted at true azimuth from two
+centers on the equator at longitudes
+.IR lon0 ,
+great circles are straight lines
+(a stretched
+.IR gnomonic
+)
+.TP
+.BI elliptic " lon0"
+points plotted at true distance from
+two centers on the equator at longitudes
+.I lon0
+.TP
+.B globular
+hemisphere is circle,
+circular arc meridians equally spaced on equator,
+circular arc parallels equally spaced on 0- and 90-degree meridians
+.TP
+.B vandergrinten
+sphere is circle,
+meridians as in
+.IR globular ,
+circular arc parallels resemble 
+.I mercator
+.TP
+.B eisenlohr
+conformal with no singularities, shaped like polyconic
+.PD
+.br
+.PP
+Doubly periodic conformal projections.
+.TP 1.5i
+.B guyou
+W and E hemispheres are square
+.PD 0
+.TP
+.B square
+world is square with Poles
+at diagonally opposite corners
+.TP
+.B tetra
+map on tetrahedron with edge
+tangent to Prime Meridian at S Pole,
+unfolded into equilateral triangle
+.TP
+.B hex
+world is hexagon centered
+on N Pole, N and S hemispheres are equilateral
+triangles
+.PD
+.br
+.PP
+Miscellaneous projections.
+.PP
+.PD 0
+.TP 1.5i
+.BI harrison " dist angle"
+oblique perspective from above the North Pole,
+.I dist
+earth radii from center of earth, looking
+along the Date Line
+.I angle
+degrees off vertical
+.TP
+.BI trapezoidal " lat0 lat1"
+equally spaced parallels,
+straight meridians equally spaced along parallels,
+true scale at
+.I lat0
+and
+.I lat1
+on Prime Meridian
+.PD
+.br
+.B lune(lat,angle)
+conformal, polar cap above latitude
+.I lat
+maps to convex lune with given
+.I angle
+at 90E and 90W
+.br
+.PP
+Retroazimuthal projections.
+At every point the angle between vertical and a straight line to
+`Mecca', latitude
+.I lat0
+on the prime meridian,
+is the true bearing of Mecca.
+.PP
+.PD 0
+.TP 1.5i
+.BI mecca " lat0"
+equally spaced vertical meridians
+.TP
+.BI homing " lat0"
+distances to Mecca are true
+.PD
+.br
+.PP
+Maps based on the spheroid.
+Of geodetic quality, these projections do not make sense
+for tilted orientations.
+For descriptions, see corresponding maps above.
+.PP
+.PD 0
+.TP 1.5i
+.B sp_mercator
+.TP
+.BI sp_albers " lat0 lat1"
+.PD
+.SH EXAMPLES
+.TP
+.L
+map perspective 1.025 -o 40.75 74
+A view looking down on New York from 100 miles
+(0.025 of the 4000-mile earth radius) up.
+The job can be done faster by limiting the map so as not to `plot'
+the invisible part of the world:
+.LR "map perspective 1.025 -o 40.75 74 -l 20 60 30 100".
+A circular border can be forced by adding option
+.LR "-w 77.33" .
+(Latitude 77.33 falls just inside a polar cap of
+opening angle arccos(1/1.025) = 12.6804 degrees.)
+.TP
+.L
+map mercator -o 49.25 -106 180
+An `equatorial' map of the earth
+centered on New York.
+The pole of the map is placed 90 degrees away (40.75+49.25=90)
+on the
+other side of the earth.
+A 180 twist around the pole of the map arranges that the
+`Prime Meridian' of the map runs from the pole of the
+map over the North Pole to New York
+instead of down the back side of the earth.
+The same effect can be had from
+.L
+map mercator -o 130.75 74
+.TP
+.L
+map albers 28 45 -l 20 50 60 130 -m states
+A customary curved-latitude map of the United States.
+.TP
+.L
+map harrison 2 30 -l -90 90 120 240 -o 90 0 0
+A fan view covering 60 degrees on either
+side of the Date Line, as seen from one earth radius
+above the North Pole gazing at the
+earth's limb, which is 30 degrees off vertical.
+The
+.B -o
+option overrides the default
+.BR "-o 90 0 180" , 
+which would rotate
+the scene to behind the observer.
+.SH FILES
+.TF $MAPDIR/lib/map/[1-4]??
+.TP
+.B $MAPDIR/lib/[1-4]??
+World Data Bank II, for
+.B -f
+.TP
+.B $MAPDIR/lib/*
+maps for
+.B -m
+.TP
+.B $MAPDIR/lib/*.x
+map indexes
+.TP
+.B $MAPDIR/bin/map
+Map driver program
+.SH "SEE ALSO"
+.IR map (3), 
+.IR map (5)
+.SH DIAGNOSTICS
+Diagnostics include a version identifier.  Thus
+.I map
+with no arguments may be used to ascertain the version.
+.PP
+`Map seems to be empty'\(ema coarse survey found
+zero extent within the 
+.B -l
+and
+.BR -w 
+bounds; for maps of limited extent
+the grid resolution,
+.IR res ,
+or the limits may have to be refined.
+.SH BUGS
+Windows (option
+.BR -w )
+cannot cross the Date Line.
+.br
+Segments that cross a border are dropped, not clipped.
+.br
+Segments that traverse too far across a map may be
+dropped in the supposition that they were intended 
+to wrap around at an edge.  Intentionally long
+segments, as often occur in boundary tracks (see
+.BR -b ),
+are particularly susceptible to this treatment.
+There is no general fix, but sometimes the long
+segments can be broken into shorter pieces.
+.br
+The west-longitude-positive convention
+betrays Yankee chauvinism.
+.br
+.I Gilbert
+should be a map from sphere to sphere, independent of
+the mapping from sphere to plane.
+.br
+The outer boundary of
+.I elliptic
+is poorly drawn.
+.br
+.I Lambert
+with both standard parallels near the south pole
+is refused; it should approach stereographic.
+.SH "SEE ALSO
+.IR map (3),
+.IR map (5)
+.SH COPYRIGHT
+.PP
+Copyright (C) 1998, Lucent Technologies
+.br
+All rights reserved
diff --git a/src/doug/doc/map.1.ps b/src/doug/doc/map.1.ps
new file mode 100644
index 0000000..740f859
--- /dev/null
+++ b/src/doug/doc/map.1.ps
@@ -0,0 +1,801 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Tue Mar 30 12:14:50 2004
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%+ font Symbol
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 5
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+%%IncludeResource: font Symbol
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic at 0 ENC0/Times-Italic RE/Times-Bold at 0 ENC0/Times-Bold RE
+/Times-Roman at 0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283129204d4150283129>72 48 R/F1
+10.95/Times-Bold at 0 SF -.219<4e41>72 84 S<4d45>.219 E F0
+<6d617020ad20647261>108 96 Q 2.5<776d>-.15 G<617073206f6e2076>-2.5 E
+<6172696f75732070726f6a656374696f6e73>-.25 E F1<53594e4f50534953>72
+112.8 Q/F2 10/Times-Bold at 0 SF<6d6170>108 124.8 Q/F3 10/Times-Italic at 0 SF
+<7072>3.75 E<6f6a656374696f6e>-.45 E F0<5b>2.74 E F3
+<6f7074696f6e202e2e2e>2.73 E F0<5d>5 E F1<4445534352495054494f4e>72
+141.6 Q F3<4d6170>108.68 153.6 Q F0 .435<7072657061726573206f6e20746865
+207374616e64617264206f75747075742061206d6170207375697461626c6520666f7220
+646973706c617920696e20506f73745363726970742e>3.126 F .435<427920646566>
+5.435 F .435<61756c742c206d61707320617265207363616c6564>-.1 F<746f208c74
+20696e206120362e352d696e6368207371756172652063656e7465726564203120696e63
+682066726f6d2074686520746f70206f6620616e20382e35>108 165.6 Q/F4 10
+/Symbol SF<b4>A F0<31312d696e636820706167652e>A<54686520646566>108 182.4
+Q<61756c74206461746120666f72>-.1 E F3<6d6170>2.88 E F0<6172652077>2.69 E
+<6f726c642073686f72656c696e65732e>-.1 E<4f7074696f6e>5 E F2<2d66>2.5 E
+F0<6163636573736573206d6f72652064657461696c6564206461746120636c61737369
+8c656420627920666561747572652e>2.5 E F2<2d66>108 199.2 Q F0<5b>2.5 E F3
+<666561747572>2.5 E<65>-.37 E F0<2e2e2e205d>2.5 E 1.772
+<4665617475726573206172652072616e6b>144 211.2 R 1.772
+<656420312028646566>-.1 F 1.772
+<61756c742920746f20342066726f6d206d616a6f7220746f206d696e6f72>-.1 F
+6.772<2e48>-.55 G<6967686572>-6.772 E 1.773
+<2d6e756d62657265642072616e6b7320696e636c75646520616c6c>-.2 F<6c6f>144
+223.2 Q<776572>-.25 E<2d6e756d6265726564206f6e65732e>-.2 E
+<466561747572657320617265>5 E F2<73686f72>144 235.2 Q<65>-.18 E F0<5b>A
+F2<31>A F0<2d>A F2<34>A F0<5d>A<736561636f617374732c206c616b>180 247.2 Q
+<65732c20616e642069736c616e64733b206f7074696f6e>-.1 E F2<2d66>2.5 E F0
+<616c>2.5 E -.1<7761>-.1 G<79732073686f>.1 E<7773>-.25 E F2<73686f72>2.5
+E<6531>-.18 E<696c616b>144 259.2 Q<65>-.1 E F0<5b>A F2<31>A F0<2d>A F2
+<32>A F0<5d>A<696e7465726d697474656e74206c616b>180 271.2 Q<6573>-.1 E F2
+<7269>144 283.2 Q -.1<7665>-.1 G<72>.1 E F0<5b>A F2<31>A F0<2d>A F2<34>A
+F0<5d>A<7269>180 295.2 Q -.15<7665>-.25 G<7273>.15 E F2<697269>144 307.2
+Q -.1<7665>-.1 G<72>.1 E F0<5b>A F2<31>A F0<2d>A F2<33>A F0<5d>A
+<696e7465726d697474656e74207269>180 319.2 Q -.15<7665>-.25 G<7273>.15 E
+F2<63616e616c>144 331.2 Q F0<5b>A F2<31>A F0<2d>A F2<33>A F0<5d>A F2<33>
+180 343.2 Q F0<3d6972726967>A<6174696f6e2063616e616c73>-.05 E F2
+<676c6163696572>144 355.2 Q<6963657368656c66>144 367.2 Q F0<5b>A F2
+<3132>A F0<5d>A F2 -.18<7265>144 379.2 S<6566>.18 E<73616c7470616e>144
+391.2 Q F0<5b>A F2<3132>A F0<5d>A F2<636f756e747279>144 403.2 Q F0<5b>A
+F2<31>A F0<2d>A F2<33>A F0<5d>A F2<32>180 415.2 Q F0
+<3d646973707574656420626f756e6461726965732c>A F2<33>2.5 E F0
+<3d696e64658c6e69746520626f756e646172696573>A F2<7374617465>144 427.2 Q
+F0<73746174657320616e642070726f>16.01 E
+<76696e6365732028555320616e642043616e616461206f6e6c7929>-.15 E<496e206f
+74686572206f7074696f6e7320636f6f7264696e617465732061726520696e206465>108
+444 Q<67726565732c2077697468206e6f727468206c6174697475646520616e64207765
+7374206c6f6e67697475646520636f756e74656420617320706f73697469>-.15 E -.15
+<7665>-.25 G<2e>.15 E F2<2d6c>108 460.8 Q F3 2.5<534e4557>2.5 G F0 1.072
+<5365742074686520736f75746865726e20616e64206e6f72746865726e206c61746974
+75646520616e6420746865206561737465726e20616e64207765737465726e206c6f6e67
+6974756465206c696d6974732e>133 472.8 R 1.071<4d697373696e67206172>6.071
+F<67752d>-.18 E .009<6d656e747320617265208c6c6c6564206f75742066726f6d20
+746865206c69737420ad39302c2039302c20ad3138302c203138302c206f72206c657373
+6572206c696d697473207375697461626c6520746f207468652070726f6a656374696f6e
+2061742068616e642e>133 484.8 R F2<2d6b>108 501.6 Q F3 2.5<534e4557>2.5 G
+F0 .619<53657420746865207363616c6520617320696620666f722061206d6170207769
+7468206c696d697473>133 513.6 R F2<2d6c>3.119 E F3 3.118<534e4557>3.448 G
+F0 5.618<2e44>C 3.118<6f6e>-5.618 G .618<6f7420636f6e736964657220616e>
+-3.118 F<79>-.15 E F2<2d6c>3.118 E F0<6f72>3.118 E F2<2d77>3.118 E F0
+.618<6f7074696f6e20696e2073657474696e67>3.118 F<7363616c652e>133 525.6 Q
+F2<2d6f>108 542.4 Q F3<6c6174206c6f6e2072>2.5 E<6f74>-.45 E F0 1.12<4f72
+69656e7420746865206d617020696e2061206e6f6e7374616e6461726420706f73697469
+6f6e2e>133 554.4 R 1.12<496d6167696e652061207472616e73706172656e74206772
+6964646564207370686572652061726f756e642074686520676c6f62652e>6.12 F -.45
+<5475>133 566.4 S .657<726e20746865206f>.45 F -.15<7665>-.15 G .656<726c
+61792061626f757420746865204e6f72746820506f6c6520736f20746861742074686520
+5072696d65204d6572696469616e20286c6f6e676974756465203029206f662074686520
+6f>.15 F -.15<7665>-.15 G .656<726c617920636f696e2d>.15 F .388
+<63696465732077697468206d6572696469616e>133 578.4 R F3<6c6f6e>2.979 E F0
+.389<6f6e2074686520676c6f62652e>3.129 F .389
+<5468656e2074696c7420746865204e6f72746820506f6c65206f6620746865206f>
+5.389 F -.15<7665>-.15 G .389
+<726c617920616c6f6e6720697473205072696d65204d657269642d>.15 F .216
+<69616e20746f206c61746974756465>133 590.4 R F3<6c6174>2.806 E F0 .216
+<6f6e2074686520676c6f62652e>3.396 F .215<46696e616c6c79206167>5.215 F
+.215<61696e207475726e20746865206f>-.05 F -.15<7665>-.15 G .215<726c6179
+2061626f75742069747320604e6f72746820506f6c652720736f20746861742069747320
+5072696d65>.15 F .452
+<4d6572696469616e20636f696e636964657320776974682074686520707265>133
+602.4 R .452<76696f757320706f736974696f6e206f66206d6572696469616e>-.25 F
+F3 -.45<726f>2.952 G<74>.45 E F0 5.452<2e50>.68 G .452
+<726f6a65637420746865206d617020696e20746865207374616e6461726420666f726d>
+-5.452 F .212<617070726f70726961746520746f20746865206f>133 614.4 R -.15
+<7665>-.15 G<726c6179>.15 E 2.712<2c62>-.65 G .212<75742070726573656e74
+696e6720696e666f726d6174696f6e2066726f6d2074686520756e6465726c79696e6720
+676c6f62652e>-2.912 F .211<4d697373696e67206172>5.211 F<67756d656e7473>
+-.18 E .661<617265208c6c6c6564206f75742066726f6d20746865206c697374203930
+2c20302c20302e>133 626.4 R .661<496e2074686520616273656e6365206f66>5.661
+F F2<2d>3.161 E F0<6f>A F2<2c>A F0 .661
+<746865206f7269656e746174696f6e2069732039302c20302c>3.161 F F3<6d>3.161
+E F0 3.161<2c77>.32 G<68657265>-3.161 E F3<6d>3.541 E F0 .661
+<697320746865>3.481 F
+<6d6964646c65206f6620746865206c6f6e6769747564652072616e67652e>133 638.4
+Q F2<2d77>108 655.2 Q F3 2.5<534e4557>2.5 G F0 -.4<5769>133 667.2 S
+<6e646f>.4 E 3.763<7774>-.25 G 1.263<6865206d61702062792074686520737065
+63698c6564206c617469747564657320616e64206c6f6e6769747564657320696e207468
+652074696c7465642c20726f746174656420636f6f7264696e6174652073797374656d2e>
+-3.763 F .521<4d697373696e67206172>133 679.2 R .521<67756d656e7473206172
+65208c6c6c6564206f75742066726f6d20746865206c69737420ad39302c2039302c20ad
+3138302c203138302e>-.18 F .521<284974206973207769736520746f206769>5.521
+F .822 -.15<76652061>-.25 H 3.022<6e65>.15 G<6e636f6d706173732d>-3.022 E
+<696e67>133 691.2 Q F2<2d6c>2.5 E F0<6f7074696f6e2077697468>2.5 E F2
+<2d77>2.5 E F0 5<2e4f>C
+<746865727769736520666f7220736d616c6c2077696e646f>-5 E
+<777320636f6d707574696e672074696d652076>-.25 E<617269657320696e>-.25 E
+-.15<7665>-.4 G<7273656c79207769746820617265612129>.15 E F2<2d64>108 708
+Q F3<6e>2.5 E F0 -.15<466f>8.61 G 2.5<7273>.15 G
+<706565642c20706c6f74206f6e6c792065>-2.5 E -.15<7665>-.25 G<7279>.15 E
+F3<6e>2.5 E F0<746820706f696e742e>.24 E<31>535 768 Q 0 Cg EP
+%%Page: 2 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283129204d4150283129>72 48 R/F1 10
+/Times-Bold at 0 SF<2d72>108 84 Q F0<5265>17.23 E -.15<7665>-.25 G<72736520
+6c65667420616e642072696768742028676f6f6420666f72207374617220636861727473
+20616e6420696e736964652d6f757420766965>.15 E<7773292e>-.25 E F1<2d76>108
+100.8 Q F0 -1.11<5665>16.67 G 2.726<72736f2e20537769746368>1.11 F .226<
+746f2061206e6f726d616c6c792073757070726573736564207368656574206f66207468
+65206d61702c207375636820617320746865206261636b2073696465206f662074686520
+656172746820696e206f7274686f2d>2.726 F
+<677261706869632070726f6a656374696f6e2e>133 112.8 Q F1<2d7331>108 129.6
+Q<2d7332>108 141.6 Q F0
+<5375706572706f73653b206f75747075747320666f722061>12.78 E F1<2d7331>2.5
+E F0<6d617020286e6f20636c6f73696e672920616e642061>2.5 E F1<2d7332>2.5 E
+F0<6d617020286e6f206f70656e696e6729206d617920626520636f6e636174656e6174
+65642e>2.5 E F1<2d67>108 158.4 Q/F2 10/Times-Italic at 0 SF
+<646c617420646c6f6e2072>2.5 E<6573>-.37 E F0 .174
+<477269642073706163696e677320617265>133 170.4 R F2<646c6174>2.674 E F0
+<2c>.68 E F2<646c6f6e>2.674 E F0 5.174<2e5a>.24 G .174
+<65726f2073706163696e67206d65616e73206e6f20677269642e>-5.174 F
+<4d697373696e67>5.174 E F2<646c6174>3.024 E F0 .174<69732074616b>3.354 F
+.174<656e20746f206265207a65726f2e>-.1 F<4d697373696e67>5.175 E F2
+<646c6f6e>133.35 182.4 Q F0 .364<69732074616b>3.104 F .364
+<656e207468652073616d65206173>-.1 F F2<646c6174>2.864 E F0 5.363<2e47>
+.68 G .363<726964206c696e65732061726520647261>-5.363 F .363
+<776e20746f2061207265736f6c7574696f6e206f66>-.15 F F2 -.37<7265>2.863 G
+<73>.37 E F0<28616461707469>3.133 E -.15<7665>-.25 G .363
+<6c792064657465726d696e6564206279>.15 F<646566>133 194.4 Q 2.5
+<61756c74292e20496e>-.1 F<74686520616273656e6365206f66>2.5 E F1<2d>2.5 E
+F0<67>A F1<2c>A F0<677269642073706163696e672069732031302e>2.5 E F1<2d70>
+108 211.2 Q F2<6c6174206c6f6e2065>2.5 E<7874656e74>-.2 E F0 1.083
+<506f736974696f6e2074686520706f696e74>133 223.2 R F2 1.083
+<6c61742c206c6f6e>3.673 F F0 1.084
+<6174207468652063656e746572206f662074686520706c6f7474696e6720617265612e>
+3.823 F 1.084<5363616c6520746865206d617020736f20746861742074686520686569
+6768742028616e64>6.084 F .223<776964746829206f6620746865206e6f6d696e616c
+20706c6f7474696e672061726561206973>133 235.2 R F2 -.2<6578>2.723 G
+<74656e74>.2 E F0 .223<74696d6573207468652073697a65206f66206f6e65206465>
+3.403 F .222
+<67726565206f66206c61746974756465206174207468652063656e746572>-.15 F
+5.222<2e42>-.55 G<79>-5.222 E<646566>133 247.2 Q<61756c74206d6170732061
+7265207363616c656420616e6420706f736974696f6e656420746f208c74207769746869
+6e2074686520706c6f7474696e6720617265612e>-.1 E<416e>5 E F2 -.2<6578>2.5
+G<74656e74>.2 E F0 -.15<6f7665>3.18 G<727269646573206f7074696f6e>.15 E
+F1<2d6b>2.5 E F0<2e>A F1<2d63>108 264 Q F2 2.5<787972>2.5 G<6f74>-2.95 E
+F0 .545<416674657220616c6c206f7468657220706f736974696f6e696e6720616e6420
+7363616c696e67206f7065726174696f6e73206861>133 276 R .845 -.15<76652062>
+-.2 H .545
+<65656e20706572666f726d65642c20726f746174652074686520696d616765>.15 F F2
+-.45<726f>3.045 G<74>.45 E F0<6465>3.725 E<6772656573>-.15 E .636<636f75
+6e746572636c6f636b776973652061626f7574207468652063656e74657220616e64206d
+6f>133 288 R .936 -.15<76652074>-.15 H .636
+<68652063656e74657220746f20706f736974696f6e>.15 F F2<78>3.136 E F0<2c>
+.53 E F2<79>3.135 E F0 .635
+<696e20746865206e6f6d696e616c20706c6f7474696e6720617265612c>3.135 F
+<77686f736520636f6f7264696e617465732072756e2066726f6d20ad3120746f20312e>
+133 300 Q<4d697373696e67206172>5 E<67756d656e7473206172652074616b>-.18 E
+<656e20746f20626520302e>-.1 E F1<2d78>108 316.8 Q F0<416c6c6f>16.67 E
+2.5<7774>-.25 G<6865206d617020746f2065>-2.5 E<7874656e64206f757473696465
+20746865206e6f6d696e616c20706c6f7474696e6720617265612e>-.15 E F1<2d6d>
+108 333.6 Q F0<5b>2.5 E F2<8c6c65>2.5 E F0<2e2e2e205d>2.5 E .934
+<557365206d617020646174612066726f6d206e616d6564208c6c65732e>133 345.6 R
+.935<4966206e6f208c6c657320617265206e616d65642c206f6d6974206d6170206461
+74612e>5.935 F .935<4e616d6573207468617420646f206e6f742065>5.935 F .935
+<78697374206173>-.15 F<706174686e616d657320617265206c6f6f6b>133 357.6 Q
+<656420757020696e2061207374616e64617264206469726563746f7279>-.1 E 2.5
+<2c77>-.65 G<6869636820636f6e7461696e732c20696e206164646974696f6e20746f
+20746865206461746120666f72>-2.5 E F1<2d66>2.5 E F0<2c>A F1 -.1<776f>133
+369.6 S<726c64>.1 E F0 -.8<576f>11.1 G
+<726c6420446174612042616e6b20492028646566>.8 E<61756c7429>-.1 E F1
+<737461746573>133 381.6 Q F0
+<5553206d61702066726f6d2043656e73757320427572656175>12.12 E F1
+<636f756e74696573>133 393.6 Q F0
+<5553206d61702066726f6d2043656e73757320427572656175>169 405.6 Q
+<54686520656e>133 422.4 Q<7669726f6e6d656e742076>-.4 E<61726961626c65>
+-.25 E F1<4d4150444952>2.5 E F0
+<6368616e67657320746865207374616e64617264206469726563746f7279>2.5 E<2e>
+-.65 E F1<2d62>108 439.2 Q F0<5b>2.5 E F2
+<6c617430206c6f6e30206c617431206c6f6e31>A F0<2e2e2e205d>A .666
+<53757070726573732074686520647261>133 451.2 R .666<77696e67206f66207468
+65206e6f726d616c20626f756e64617279202864657465726d696e656420627920746865
+2070726f6a656374696f6e20616e64206f7074696f6e73>-.15 F F1<2d6c>3.166 E F0
+<616e64>3.166 E F1<2d77>3.166 E F0<292e>A .147<436f6f7264696e617465732c
+2069662070726573656e742c2064658c6e65207468652076>133 463.2 R .148<657274
+69636573206f66206120706f6c79676f6e20746f20776869636820746865206d61702069
+7320636c69707065642e>-.15 F .148<4966206f6e6c79207477>5.148 F 2.648
+<6f76>-.1 G<6572>-2.798 E<2d>-.2 E .034<746963657320617265206769>133
+475.2 R -.15<7665>-.25 G .034<6e2c20746865>.15 F 2.533<7961>-.15 G .033
+<72652074616b>-2.533 F .033<656e20746f2062652074686520646961676f6e616c20
+6f6620612072656374616e676c652e>-.1 F 1.633 -.8<546f2064>5.033 H<7261>.8
+E 2.533<7774>-.15 G .033<686520706f6c79676f6e2c206769>-2.533 F .333 -.15
+<76652069>-.25 H .033<74732076>.15 F<65727469636573>-.15 E<61732061>133
+487.2 Q F1<2d75>2.5 E F0<747261636b2e>2.5 E F1<2d74>108 504 Q F2
+<8c6c65202e2e2e>2.5 E F0<546865>133 516 Q F2<8c6c6573>4.727 E F0 .317
+<636f6e7461696e206c69737473206f6620706f696e74732c206769>3.087 F -.15
+<7665>-.25 G 2.818<6e61>.15 G 2.818<736c>-2.818 G .318
+<617469747564652d6c6f6e67697475646520706169727320696e206465>-2.818 F
+2.818<67726565732e204966>-.15 F .318
+<746865208c727374208c6c65206973206e616d6564>2.818 F F1<ad>133 528 Q F0
+2.5<2c74>C<6865207374616e6461726420696e7075742069732074616b>-2.5 E
+<656e20696e73746561642e>-.1 E<54686520706f696e7473206f662065616368206c69
+73742061726520636f6e6e656374656420627920646f742d6461736820747261636b732e>
+5 E .227
+<506f696e747320696e206120747261636b208c6c65206d617920626520666f6c6c6f>
+133 544.8 R .227<776564206279206c6162656c20737472696e67732e>-.25 F 2.727
+<416c>5.227 G .227<6162656c20627265616b732074686520747261636b2e>-2.727 F
+2.727<416c>5.227 G .227<6162656c206d6179206265207072652d>-2.727 F<8c78>
+133 556.8 Q .29<6564206279>-.15 F F1<22>2.79 E F0<2c>A F1<3a>2.79 E F0
+2.79<2c6f>C<72>-2.79 E F1<21>2.79 E F0 .29
+<616e64206973207465726d696e617465642062792061206e65>5.29 F 2.79
+<776c696e652e20416e>-.25 F<756e7072658c78>2.79 E .29
+<656420737472696e67206f72206120737472696e67207072658c78>-.15 F .29
+<65642077697468>-.15 F F1<22>2.79 E F0<6973>2.79 E 1.555
+<646973706c61796564206174207468652064657369676e6174656420706f696e742e>
+133 568.8 R 1.555<546865208c7273742077>6.555 F 1.555<6f7264206f662061>
+-.1 F F1<3a>4.055 E F0<6f72>4.055 E F1<21>4.055 E F0 1.555
+<737472696e67206e616d65732061207370656369616c2073796d626f6c2028736565>
+6.555 F<6f7074696f6e>133 580.8 Q F1<2d79>3.906 E F0 3.906<292e20416e>B
+1.406<6f7074696f6e616c206e756d65726963616c207365636f6e642077>3.906 F
+1.407<6f72642069732061207363616c652066>-.1 F 1.407<6163746f7220666f7220
+7468652073697a65206f66207468652073796d626f6c2c2031206279>-.1 F<646566>
+133 592.8 Q 2.5<61756c742e2041>-.1 F F1<3a>2.5 E F0<73796d626f6c20697320
+616c69676e656420776974682069747320746f7020746f20746865206e6f7274683b2061>
+2.5 E F1<21>2.5 E F0<73796d626f6c20697320616c69676e65642076>5 E
+<6572746963616c6c79206f6e2074686520706167652e>-.15 E F1<2d75>108 609.6 Q
+F2<8c6c65202e2e2e>2.5 E F0<53616d65206173>133 621.6 Q F1<2d74>2.5 E F0
+2.5<2c65>C<78636570742074686520747261636b732061726520756e62726f6b>-2.65
+E<656e206c696e65732e>-.1 E F1<2d43>108 638.4 Q F2<636f6c6f72>2.5 E F0
+.492<53657420636f6c6f722028696e697469616c6c7920626c61636b292e>133 650.4
+R .492<41742065616368206f6620746865206f7074696f6e73>5.492 F F1<2d62>
+2.992 E F0<2c>A F1<2d67>2.992 E F0<2c>A F1<2d6d>2.991 E F0<2c>A F1<2d74>
+2.991 E F0 2.991<2c61>C<6e64>-2.991 E F1<2d75>2.991 E F0 .491
+<746865206d6f737420726563656e746c792073657420636f6c6f72206973>2.991 F .4
+<72656d656d626572656420616e64207573656420746f20647261>133 662.4 R 2.9
+<7774>-.15 G .4<6865206173736f63696174656420646174612e>-2.9 F<546865>5.4
+E F2<636f6c6f72>3.101 E F0 .401<6973206f6e65206f66>3.631 F F1
+<626c61636b>2.901 E F0<2c>A F1 -.18<7265>2.901 G<64>.18 E F0<2c>A F1
+<6772>2.901 E<65656e>-.18 E F0<2c>A F1<626c7565>2.901 E F0 2.901<2c6f>C
+2.901<7261>-2.901 G .161
+<506f73745363726970742048534220636f64652c2073756368206173>133 674.4 R F1
+<2e33332c2e352c31>2.661 E F0 .161
+<286120627269676874206c696768742067726565656e292e>2.661 F .16<546865206e
+756d626572732072616e67652066726f6d203020746f203120666f7220687565>5.161 F
+<2872656420746f2076696f6c6574292c2073617475726174696f6e2028756e73617475
+726174656420746f2066756c6c2920616e64206272696768746e65737320286f66>133
+686.4 Q 2.5<6674>-.25 G 2.5<6f66>-2.5 G<756c6c292e>-2.5 E F1<2d79>108
+703.2 Q F2<8c6c65>2.5 E F0<546865>133 715.2 Q F2<8c6c65>4.618 E F0 .209<
+646573637269626573206120706c6f7474696e672073796d626f6c206173206120736571
+75656e6365206f66207374726f6b>2.888 F 2.709<65732e2041>-.1 F .209
+<6e6f726d616c2d73697a652073796d626f6c2068617320636f6f7264696e61746573>
+2.709 F .296<72756e6e696e672066726f6d20ad3120746f20312e>133 727.2 R .296
+<4c6f636174696f6e2028302c30292066>5.296 F .296<616c6c73206f6e2074686520
+706c6f7474696e6720706f696e74207768656e20612073796d626f6c20697320706c6163
+6564206279>-.1 F F1<3a>2.795 E F0<6f72>2.795 E F1<21>2.795 E F0<696e>
+5.295 E<32>535 768 Q 0 Cg EP
+%%Page: 3 3
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283129204d4150283129>72 48 R 2.5
+<6174>133 84 S 2.5<7261636b2e2028536565>-2.5 F<6f7074696f6e>2.5 E/F1 10
+/Times-Bold at 0 SF<2d74>2.5 E F0 2.5<2e2920546865>B
+<8c6c6520636f6e7461696e73206c696e6573206f662074686520666f6c6c6f>2.5 E
+<77696e6720666f726d732e>-.25 E F1<3a>133 96 Q/F2 10/Times-Italic at 0 SF
+<6e616d65>2.5 E F0
+<6e616d65206f662073796d626f6c2c206d75737420636f6d65208c727374>8.51 E F1
+<6d>133 108 Q F2 2.5<7879>2.5 G F0<6d6f>11.29 E .3 -.15<76652074>-.15 H
+2.5<6f67>.15 G -2.15 -.25<69762065>-2.5 H 2.5<6e70>.25 G<6f696e74>-2.5 E
+F1<76>133 120 Q F2 2.5<7879>2.5 G F0<647261>14.62 E 2.5<7776>-.15 G
+<6563746f722066726f6d20707265>-2.65 E
+<76696f757320706f696e7420746f2068657265>-.25 E F1<5072>87 136.8 Q
+<6f6a656374696f6e73>-.18 E F0 2.5<416d>108 153.6 S<656e75206f662070726f
+6a656374696f6e732069732070726f647563656420696e20726573706f6e736520746f20
+616e20756e6b6e6f>-2.5 E<776e>-.25 E F2<7072>2.5 E<6f6a656374696f6e>-.45
+E F0<2e>.24 E .298<45717561746f7269616c2070726f6a656374696f6e732063656e
+7465726564206f6e20746865205072696d65204d6572696469616e20286c6f6e67697475
+64652030292e>108 170.4 R -.15<5061>5.299 G .299<72616c6c656c732061726520
+737472616967687420686f72697a6f6e74616c206c696e65732e>.15 F F1<6d6572>108
+187.2 Q<6361746f72>-.18 E F0<657175616c6c792073706163656420737472616967
+6874206d6572696469616e732c20636f6e666f726d616c2c20737472616967687420636f
+6d7061737320636f7572736573>68.76 E F1<73696e75736f6964616c>108 199.2 Q
+F0<657175616c6c792073706163656420706172616c6c656c732c20657175616c2d6172
+65612c2073616d65206173>65.2 E F1<626f6e6e65>2.5 E F0<30>A F1<2e>A
+<63796c657175616c6172>108 211.2 Q<6561>-.18 E F2<6c617430>2.5 E F0<6571
+75616c6c7920737061636564207374726169676874206d6572696469616e732c20657175
+616c2d617265612c2074727565207363616c65206f6e>35.68 E F2<6c617430>2.59 E
+F1<63796c696e64726963616c>108 223.2 Q F0
+<63656e7472616c2070726f6a656374696f6e206f6e2074616e67656e742063>62.44 E
+<796c696e646572>-.15 E F1 -.18<7265>108 235.2 S<6374616e67756c6172>.18 E
+F2<6c617430>2.5 E F0<657175616c6c792073706163656420706172616c6c656c732c
+20657175616c6c7920737061636564207374726169676874206d6572696469616e732c20
+74727565207363616c65206f6e>40.13 E F2<6c617430>2.59 E F1<67616c6c>108
+247.2 Q F2<6c617430>2.5 E F0 2.001<706172616c6c656c73207370616365642073
+746572656f67726170686963616c6c79206f6e207072696d65206d6572696469616e2c20
+657175616c6c7920737061636564207374726169676874>74.38 F
+<6d6572696469616e732c2074727565207363616c65206f6e>216 259.2 Q F2
+<6c617430>2.59 E F1<6d6f6c6c7765696465>108 271.2 Q F0<28686f6d616c6f6772
+61706869632920657175616c2d617265612c2068656d6973706865726520697320612063
+6972636c65>64.67 E F1<67696c62657274>108 283.2 Q F0<676c6f6265206d617070
+656420636f6e666f726d616c6c79206f6e2068656d697370686572652c20766965>79.67
+E<776564206f7274686f67726170686963616c6c79>-.25 E .707<417a696d75746861
+6c2070726f6a656374696f6e732063656e7465726564206f6e20746865204e6f72746820
+506f6c652e>108 300 R -.15<5061>5.707 G .707
+<72616c6c656c732061726520636f6e63656e7472696320636972636c65732e>.15 F
+.707<4d6572696469616e732061726520657175616c6c79>5.707 F
+<7370616365642072616469616c206c696e65732e>108 312 Q F1
+<617a6571756964697374616e74>108 328.8 Q F0<657175616c6c7920737061636564
+20706172616c6c656c732c20747275652064697374616e6365732066726f6d20706f6c65>
+50.77 E F1<617a657175616c6172>108 340.8 Q<6561>-.18 E F0
+<657175616c2d61726561>56.52 E F1<676e6f6d6f6e6963>108 352.8 Q F0<63656e
+7472616c2070726f6a656374696f6e206f6e2074616e67656e7420706c616e652c207374
+72616967687420677265617420636972636c6573>66.33 E F1<706572737065637469>
+108 364.8 Q -.1<7665>-.1 G F2<64697374>2.6 E F0<766965>42.93 E
+<77656420616c6f6e6720656172746827>-.25 E 2.5<7361>-.55 G<786973>-2.5 E
+F2<64697374>2.85 E F0
+<65617274682072616469692066726f6d2063656e746572206f66206561727468>3.18 E
+F1<6f7274686f67726170686963>108 376.8 Q F0<766965>51.89 E
+<7765642066726f6d20696e8c6e697479>-.25 E F1<73746572>108 388.8 Q
+<656f67726170686963>-.18 E F0<636f6e666f726d616c2c2070726f6a656374656420
+66726f6d206f70706f7369746520706f6c65>49.86 E F1<6c617565>108 400.8 Q F2
+-.15<7261>90.22 G<64697573>.15 E F0 2.5<3d74>2.77 G<616e2832>-2.5 E/F3
+10/Symbol SF<b4>A F2<636f6c61746974756465>.2 E F0
+<292c207573656420696e20582d726179206372797374616c6c6f6772617068>.18 E
+<79>-.05 E F1<8c73686579>108 412.8 Q<65>-.1 E F2<6e>2.5 E F0<7374657265
+6f67726170686963207365656e2066726f6d206a75737420696e73696465206d65646975
+6d2077697468207265667261637469>71.71 E .3 -.15<76652069>-.25 H<6e6465>
+.15 E<78>-.15 E F2<6e>2.86 E F1<6e657779>108 424.8 Q<6f726b>-.25 E<6572>
+-.1 E F2 55.86<7272>2.5 G<6164697573>-56.01 E F0 3.503<3d6c>3.773 G
+<6f6728>-3.503 E F2<636f6c61746974756465>.2 E F0<2f>.18 E F2<72>.05 E F0
+<293a>.73 E F2<4e65>4.203 E 3.503<7759>-.15 G<6f726b>-4.423 E<6572>-.1 E
+F0 1.003<6d61702066726f6d20766965>4.233 F 1.002
+<77696e6720706564657374616c206f6620726164697573>-.25 F F2<72>3.552 E F0
+<6465>216 436.8 Q<6772656573>-.15 E .61<506f6c617220636f6e69632070726f6a
+656374696f6e732073796d6d65747269632061626f757420746865205072696d65204d65
+72696469616e2e>108 453.6 R -.15<5061>5.61 G .61
+<72616c6c656c7320617265207365>.15 F .61
+<676d656e7473206f6620636f6e63656e7472696320636972636c65732e>-.15 F<4578
+6365707420696e2074686520426f6e6e652070726f6a656374696f6e2c206d6572696469
+616e732061726520657175616c6c79207370616365642072616469616c206c696e657320
+6f7274686f676f6e616c20746f2074686520706172616c6c656c732e>108 465.6 Q F1
+<636f6e6963>108 482.4 Q F2<6c617430>2.5 E F0<63656e7472616c2070726f6a65
+6374696f6e206f6e20636f6e652074616e67656e74206174>67.72 E F2<6c617430>
+2.59 E F1<73696d706c65636f6e6963>108 494.4 Q F2<6c617430206c617431>2.5 E
+F0<657175616c6c792073706163656420706172616c6c656c732c207472756520736361
+6c65206f6e>21.88 E F2<6c617430>2.59 E F0<616e64>2.97 E F2<6c617431>2.59
+E F1<6c616d62657274>108 506.4 Q F2<6c617430206c617431>2.5 E F0
+<636f6e666f726d616c2c2074727565207363616c65206f6e>38 E F2<6c617430>2.59
+E F0<616e64>2.97 E F2<6c617431>2.59 E F1<616c62657273>108 518.4 Q F2
+<6c617430206c617431>2.5 E F0
+<657175616c2d617265612c2074727565207363616c65206f6e>45.77 E F2<6c617430>
+2.59 E F0<616e64>2.97 E F2<6c617431>2.59 E F1<626f6e6e65>108 530.4 Q F2
+<6c617430>2.5 E F0<657175616c6c792073706163656420706172616c6c656c732c20
+657175616c2d617265612c20706172616c6c656c>63.82 E F2<6c617430>2.59 E F0
+<6465>2.97 E -.15<7665>-.25 G
+<6c6f7065642066726f6d2074616e67656e7420636f6e65>.15 E<50726f6a656374696f
+6e7320776974682062696c61746572616c2073796d6d657472792061626f757420746865
+205072696d65204d6572696469616e20616e64207468652065717561746f72>108 547.2
+Q<2e>-.55 E F1<706f6c79636f6e6963>108 564 Q F0<706172616c6c656c73206465>
+67.44 E -.15<7665>-.25 G<6c6f7065642066726f6d2074616e67656e7420636f6e65
+732c20657175616c6c792073706163656420616c6f6e67205072696d65204d6572696469
+616e>.15 E F1<6169746f6666>108 576 Q F0<657175616c2d617265612070726f6a65
+6374696f6e206f6620676c6f6265206f6e746f20322d746f2d3120656c6c697073652c20
+6261736564206f6e>85.23 E F2<617a657175616c6172>2.83 E<6561>-.37 E F1
+<6c616772616e6765>108 588 Q F0<636f6e666f726d616c2c206d6170732077686f6c
+652073706865726520696e746f206120636972636c65>70.78 E F1
+<626963656e74726963>108 600 Q F2<6c6f6e30>2.5 E F0 1.919<706f696e747320
+706c6f74746564206174207472756520617a696d7574682066726f6d207477>49.95 F
+4.418<6f63>-.1 G 1.918
+<656e74657273206f6e207468652065717561746f72206174206c6f6e67697475646573>
+-4.418 F F2<6c6f6e30>216 612 Q F0 2.5<2c67>.47 G<7265617420636972636c65
+7320617265207374726169676874206c696e657320286120737472657463686564>-2.5
+E F2<676e6f6d6f6e6963>2.5 E F0<29>2.5 E F1<656c6c6970746963>108 624 Q F2
+<6c6f6e30>2.5 E F0 .125<706f696e747320706c6f7474656420617420747275652064
+697374616e63652066726f6d207477>58.83 F 2.625<6f63>-.1 G .126
+<656e74657273206f6e207468652065717561746f72206174206c6f6e67697475646573>
+-2.625 F F2<6c6f6e30>2.716 E F1<676c6f62>108 636 Q<756c6172>-.2 E F0
+1.005<68656d6973706865726520697320636972636c652c2063697263756c6172206172
+63206d6572696469616e7320657175616c6c7920737061636564206f6e2065717561746f
+72>72.08 F 3.505<2c63>-.4 G<697263756c6172>-3.505 E<61726320706172616c6c
+656c7320657175616c6c7920737061636564206f6e20302d20616e642039302d6465>216
+648 Q<67726565206d6572696469616e73>-.15 E F1 -.1<7661>108 660 S
+<6e646572>.1 E<6772696e74656e>-.1 E F0 .448
+<73706865726520697320636972636c652c206d6572696469616e7320617320696e>
+47.09 F F2<676c6f62>2.948 E<756c6172>-.2 E F0 2.948<2c63>.73 G .448
+<697263756c61722061726320706172616c6c656c7320726573656d626c65>-2.948 F
+F2<6d6572>3.329 E<63612d>-.37 E<746f72>216 672 Q F1<656973656e6c6f6872>
+108 684 Q F0<636f6e666f726d616c2077697468206e6f2073696e67756c6172697469
+65732c20736861706564206c696b>69.11 E 2.5<6570>-.1 G<6f6c79636f6e6963>
+-2.5 E<446f75626c7920706572696f64696320636f6e666f726d616c2070726f6a6563
+74696f6e732e>108 700.8 Q F1<677579>108 717.6 Q<6f75>-.25 E F0 2.5<5761>
+82.13 G<6e6420452068656d69737068657265732061726520737175617265>-2.5 E
+<33>535 768 Q 0 Cg EP
+%%Page: 4 4
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283129204d4150283129>72 48 R/F1 10
+/Times-Bold at 0 SF<7371756172>108 84 Q<65>-.18 E F0 -.1<776f>79.29 G<726c
+6420697320737175617265207769746820506f6c657320617420646961676f6e616c6c79
+206f70706f7369746520636f726e657273>.1 E F1<7465747261>108 96 Q F0 .011<
+6d6170206f6e207465747261686564726f6e207769746820656467652074616e67656e74
+20746f205072696d65204d6572696469616e206174205320506f6c652c20756e666f6c64
+656420696e746f>87.46 F<657175696c61746572616c20747269616e676c65>216 108
+Q F1<686578>108 120 Q F0 -.1<776f>93 G .246<726c64206973206865>.1 F .247
+<7861676f6e2063656e7465726564206f6e204e20506f6c652c204e20616e6420532068
+656d69737068657265732061726520657175696c61746572616c20747269616e2d>-.15
+F<676c6573>216 132 Q
+<4d697363656c6c616e656f75732070726f6a656374696f6e732e>108 148.8 Q F1
+<6861727269736f6e>108 165.6 Q/F2 10/Times-Italic at 0 SF
+<6469737420616e676c65>2.5 E F0 1.168<6f626c6971756520706572737065637469>
+29.66 F 1.468 -.15<76652066>-.25 H 1.168<726f6d2061626f>.15 F 1.468 -.15
+<76652074>-.15 H 1.168<6865204e6f72746820506f6c652c>.15 F F2<64697374>
+4.017 E F0 1.167<65617274682072616469692066726f6d2063656e746572206f66>
+4.347 F
+<65617274682c206c6f6f6b696e6720616c6f6e67207468652044617465204c696e65>
+216 177.6 Q F2<616e676c65>2.83 E F0<6465>2.68 E<6772656573206f66>-.15 E
+2.5<6676>-.25 G<6572746963616c>-2.65 E F1<74726170657a6f6964616c>108
+189.6 Q F2<6c617430206c617431>2.5 E F0 .914<657175616c6c7920737061636564
+20706172616c6c656c732c207374726169676874206d6572696469616e7320657175616c
+6c792073706163656420616c6f6e6720706172616c6c656c732c2074727565>23.55 F
+<7363616c65206174>216 201.6 Q F2<6c617430>2.59 E F0<616e64>2.97 E F2
+<6c617431>2.59 E F0<6f6e205072696d65204d6572696469616e>2.5 E F1
+<6c756e65286c61742c616e676c6529>216 213.6 Q F0 .009
+<636f6e666f726d616c2c20706f6c6172206361702061626f>2.51 F .309 -.15
+<7665206c>-.15 H<61746974756465>.15 E F2<6c6174>2.599 E F0 .009
+<6d61707320746f20636f6e>3.189 F .309 -.15<766578206c>-.4 H .009
+<756e652077697468>.15 F<6769>216 225.6 Q -.15<7665>-.25 G<6e>.15 E F2
+<616e676c65>2.83 E F0<61742039304520616e6420393057>2.68 E .694
+<526574726f617a696d757468616c2070726f6a656374696f6e732e>108 242.4 R .694
+<41742065>5.694 F -.15<7665>-.25 G .694
+<727920706f696e742074686520616e676c65206265747765656e2076>.15 F .694<65
+72746963616c20616e642061207374726169676874206c696e6520746f20604d65636361
+272c206c6174692d>-.15 F<74756465>108 254.4 Q F2<6c617430>2.59 E F0<6f6e
+20746865207072696d65206d6572696469616e2c20697320746865207472756520626561
+72696e67206f66204d656363612e>2.97 E F1<6d65636361>108 271.2 Q F2
+<6c617430>2.5 E F0<657175616c6c79207370616365642076>63.29 E
+<6572746963616c206d6572696469616e73>-.15 E F1<686f6d696e67>108 283.2 Q
+F2<6c617430>2.5 E F0
+<64697374616e63657320746f204d65636361206172652074727565>57.71 E 1.062
+<4d617073206261736564206f6e207468652073706865726f69642e>108 300 R 1.061
+<4f662067656f6465746963207175616c697479>6.061 F 3.561<2c74>-.65 G 1.061
+<686573652070726f6a656374696f6e7320646f206e6f74206d616b>-3.561 F 3.561
+<6573>-.1 G 1.061<656e736520666f722074696c746564206f7269656e74612d>
+-3.561 F 2.5<74696f6e732e2046>108 312 R<6f72206465736372697074696f6e732c
+2073656520636f72726573706f6e64696e67206d6170732061626f>-.15 E -.15<7665>
+-.15 G<2e>.15 E F1<73705f6d6572>108 328.8 Q<6361746f72>-.18 E
+<73705f616c62657273>108 340.8 Q F2<6c617430206c617431>2.5 E/F3 10.95
+/Times-Bold at 0 SF<4558414d504c4553>72 357.6 Q F1
+<6d617020706572737065637469>108 369.6 Q .2 -.1<76652031>-.1 H
+<2e303235202d6f2034302e3735203734>.1 E F0 2.768<4176>144 381.6 S<6965>
+-2.768 E 2.768<776c>-.25 G .268<6f6f6b696e6720646f>-2.768 F .269
+<776e206f6e204e65>-.25 F 2.769<7759>-.25 G .269<6f726b2066726f6d20313030
+206d696c65732028302e303235206f662074686520343030302d6d696c65206561727468
+20726164697573292075702e>-3.869 F<546865>5.269 E .332
+<6a6f622063616e20626520646f6e652066>144 393.6 R .332<617374657220627920
+6c696d6974696e6720746865206d617020736f206173206e6f7420746f2060706c6f7427
+2074686520696e>-.1 F .331<76697369626c652070617274206f66207468652077>-.4
+F<6f726c643a>-.1 E F1<6d61702d>2.831 E F0<706572737065637469>144 405.6 Q
+-.15<7665>-.25 G F1<312e303235>.15 E F0<2d6f>A F1<34302e3735>A F0<3734>A
+F1<2d6c>A F0<3230>A F1<3630>A F0<3330>A F1<313030>A F0 8.713<2e41>C
+3.713<63697263756c617220626f726465722063616e20626520666f7263656420627920
+616464696e67206f7074696f6e>-2.5 F F1<2d77>144 417.6 Q F0<37372e3333>A F1
+<2e>A F0 .474<284c617469747564652037372e33332066>5.474 F .473<616c6c7320
+6a75737420696e73696465206120706f6c617220636170206f66206f70656e696e672061
+6e676c6520617263636f7328312f312e30323529203d2031322e36383034>-.1 F<6465>
+144 429.6 Q<67726565732e29>-.15 E F1<6d6170206d6572>108 446.4 Q
+<6361746f72202d6f2034392e3235202d31303620313830>-.18 E F0 .206<416e2060
+65717561746f7269616c27206d6170206f66207468652065617274682063656e74657265
+64206f6e204e65>144 458.4 R 2.707<7759>-.25 G 2.707<6f726b2e20546865>
+-3.807 F .207
+<706f6c65206f6620746865206d617020697320706c61636564203930206465>2.707 F
+<6772656573>-.15 E -2.3 -.15<61772061>144 470.4 T 3.597<7928>.15 G 1.097
+<34302e37352b34392e32353d393029206f6e20746865206f746865722073696465206f
+66207468652065617274682e>-3.597 F 3.596<4131>6.096 G 1.096
+<38302074776973742061726f756e642074686520706f6c65206f6620746865206d6170>
+-3.596 F .57<617272616e67657320746861742074686520605072696d65204d657269
+6469616e27206f6620746865206d61702072756e732066726f6d2074686520706f6c6520
+6f6620746865206d6170206f>144 482.4 R -.15<7665>-.15 G 3.07<7274>.15 G
+.57<6865204e6f72746820506f6c65>-3.07 F .872<746f204e65>144 494.4 R 3.372
+<7759>-.25 G .872<6f726b20696e7374656164206f6620646f>-4.472 F .872
+<776e20746865206261636b2073696465206f66207468652065617274682e>-.25 F
+.871<5468652073616d65206566>5.871 F .871
+<666563742063616e206265206861642066726f6d>-.25 F F1<6d6170>3.371 E
+<6d6572>144 506.4 Q<6361746f72202d6f203133302e3735203734>-.18 E<6d617020
+616c62657273203238203435202d6c20323020353020363020313330202d6d2073746174
+6573>108 523.2 Q F0 2.5<4163>144 535.2 S<7573746f6d6172792063757276>-2.5
+E<65642d6c61746974756465206d6170206f662074686520556e69746564205374617465
+732e>-.15 E F1<6d6170206861727269736f6e2032203330202d6c202d393020393020
+31323020323430202d6f20393020302030>108 552 Q F0 3.793<4166>144 564 S
+1.293<616e20766965>-3.893 F 3.794<7763>-.25 G -.15<6f7665>-3.794 G 1.294
+<72696e67203630206465>.15 F 1.294<6772656573206f6e2065697468657220736964
+65206f66207468652044617465204c696e652c206173207365656e2066726f6d206f6e65
+20656172746820726164697573>-.15 F<61626f>144 576 Q 1.233 -.15<76652074>
+-.15 H .933<6865204e6f72746820506f6c652067>.15 F .933
+<617a696e672061742074686520656172746827>-.05 F 3.432<736c>-.55 G .932
+<696d622c207768696368206973203330206465>-3.432 F .932<6772656573206f66>
+-.15 F 3.432<6676>-.25 G 3.432<6572746963616c2e20546865>-3.582 F F1
+<2d6f>3.432 E F0<6f7074696f6e>3.432 E -.15<6f7665>144 588 S
+<7272696465732074686520646566>.15 E<61756c74>-.1 E F1
+<2d6f203930203020313830>2.5 E F0 2.5<2c77>C<686963682077>-2.5 E<6f756c64
+20726f7461746520746865207363656e6520746f20626568696e6420746865206f627365
+7276>-.1 E<6572>-.15 E<2e>-.55 E F3<46494c4553>72 604.8 Q F1
+<244d41504449522f6c69622f5b312d345d3f3f>108 616.8 Q F0 -.8<576f>144
+628.8 S<726c6420446174612042616e6b2049492c20666f72>.8 E F1<2d66>2.5 E
+<244d41504449522f6c69622f2a>108 645.6 Q F0<6d61707320666f72>144 657.6 Q
+F1<2d6d>2.5 E<244d41504449522f6c69622f2a2e78>108 674.4 Q F0
+<6d617020696e6465>144 686.4 Q -.15<7865>-.15 G<73>.15 E F1
+<244d41504449522f62696e2f6d6170>108 703.2 Q F0<4d617020647269>144 715.2
+Q -.15<7665>-.25 G 2.5<7270>.15 G<726f6772616d>-2.5 E<34>535 768 Q 0 Cg
+EP
+%%Page: 5 5
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283129204d4150283129>72 48 R/F1
+10.95/Times-Bold at 0 SF<53454520414c534f>72 84 Q/F2 10/Times-Italic at 0 SF
+<6d6170>108 96 Q F0<2833292c>.19 E F2<6d6170>2.5 E F0<283529>.19 E F1
+<444941>72 112.8 Q<474e4f5354494353>-.602 E F0 .105
+<446961676e6f737469637320696e636c75646520612076>108 124.8 R .105
+<657273696f6e206964656e74698c6572>-.15 F 5.105<2e54>-.55 G<687573>-5.105
+E F2<6d6170>2.985 E F0 .105<77697468206e6f206172>2.795 F .105<67756d656e
+7473206d6179206265207573656420746f2061736365727461696e207468652076>-.18
+F<657273696f6e2e>-.15 E .177<604d6170207365656d7320746f20626520656d7074
+79278a6120636f617273652073757276>108 141.6 R .477 -.15<65792066>-.15 H
+.177<6f756e64207a65726f2065>.15 F .177<7874656e742077697468696e20746865>
+-.15 F/F3 10/Times-Bold at 0 SF<2d6c>2.677 E F0<616e64>2.677 E F3<2d77>
+2.677 E F0 .176<626f756e64733b20666f72206d617073206f66206c696d2d>2.677 F
+<697465642065>108 153.6 Q
+<7874656e74207468652067726964207265736f6c7574696f6e2c>-.15 E F2 -.37
+<7265>2.5 G<73>.37 E F0 2.5<2c6f>.27 G 2.5<7274>-2.5 G
+<6865206c696d697473206d6179206861>-2.5 E .3 -.15<76652074>-.2 H 2.5
+<6f62>.15 G 2.5<6572>-2.5 G<658c6e65642e>-2.5 E F1 -.11<4255>72 170.4 S
+<4753>.11 E F0 -.4<5769>108 182.4 S<6e646f>.4 E<777320286f7074696f6e>
+-.25 E F3<2d77>2.5 E F0 2.5<2963>C
+<616e6e6f742063726f7373207468652044617465204c696e652e>-2.5 E<5365>108
+194.4 Q<676d656e747320746861742063726f7373206120626f72646572206172652064
+726f707065642c206e6f7420636c69707065642e>-.15 E<5365>108 206.4 Q .681
+<676d656e7473207468617420747261>-.15 F -.15<7665>-.2 G .681
+<72736520746f6f2066>.15 F .681<6172206163726f73732061206d6170206d617920
+62652064726f7070656420696e2074686520737570706f736974696f6e20746861742074
+6865>-.1 F 3.181<7977>-.15 G .682<65726520696e74656e64656420746f>-3.181
+F .182<777261702061726f756e6420617420616e20656467652e>108 218.4 R .182
+<496e74656e74696f6e616c6c79206c6f6e67207365>5.182 F .182<676d656e74732c
+206173206f6674656e206f6363757220696e20626f756e6461727920747261636b732028
+736565>-.15 F F3<2d62>2.681 E F0 .181<292c20617265207061727469632d>B
+.048<756c61726c79207375736365707469626c6520746f20746869732074726561746d
+656e742e>108 230.4 R .049
+<5468657265206973206e6f2067656e6572616c208c782c2062>5.049 F .049
+<757420736f6d6574696d657320746865206c6f6e67207365>-.2 F .049
+<676d656e74732063616e2062652062726f6b>-.15 F<656e>-.1 E
+<696e746f2073686f72746572207069656365732e>108 242.4 Q
+<54686520776573742d6c6f6e6769747564652d706f73697469>108 254.4 Q .3 -.15
+<76652063>-.25 H<6f6e>.15 E -.15<7665>-.4 G
+<6e74696f6e20626574726179732059>.15 E<616e6b>-1 E
+<6565206368617576696e69736d2e>-.1 E F2<47696c62657274>107.98 266.4 Q F0<
+73686f756c642062652061206d61702066726f6d2073706865726520746f207370686572
+652c20696e646570656e64656e74206f6620746865206d617070696e672066726f6d2073
+706865726520746f20706c616e652e>3.18 E
+<546865206f7574657220626f756e64617279206f66>108 278.4 Q F2
+<656c6c6970746963>2.69 E F0<697320706f6f726c7920647261>2.81 E<776e2e>
+-.15 E F2<4c616d62657274>108.58 290.4 Q F0<7769746820626f7468207374616e
+6461726420706172616c6c656c73206e6561722074686520736f75746820706f6c652069
+7320726566757365643b2069742073686f756c6420617070726f6163682073746572656f
+677261706869632e>3.18 E F1<53454520414c534f>72 307.2 Q F2<6d6170>108
+319.2 Q F0<2833292c>.19 E F2<6d6170>2.5 E F0<283529>.19 E F1
+<434f50595249474854>72 336 Q F0<436f70>108 348 Q
+<7972696768742028432920313939382c204c7563656e742054>-.1 E
+<6563686e6f6c6f67696573>-.7 E<416c6c2072696768747320726573657276>108 360
+Q<6564>-.15 E<35>535 768 Q 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/src/doug/doc/map.3 b/src/doug/doc/map.3
new file mode 100644
index 0000000..0795c1b
--- /dev/null
+++ b/src/doug/doc/map.3
@@ -0,0 +1,151 @@
+.so tmac.anx
+.TH MAP 3 
+.SH NAME
+orient, normalize \- map projections
+.SH SYNOPSIS
+.B orient(double lat, double lon, double rot)
+.PP
+.B normalize(struct place *p)
+.SH DESCRIPTION
+.PP
+The functions
+.I orient
+and
+.I normalize
+plus a collection of map projection generators
+are loaded by
+option
+.BR -lmap 
+of
+.IR ld (1).
+Most of them
+calculate maps for a spherical earth.
+Each map projection is available in one standard
+form, into which data must be normalized
+for transverse
+or nonpolar projections.
+.PP
+Each standard projection is displayed with the Prime
+Meridian (longitude 0) being a straight vertical line, along which North
+is up.
+The orientation of nonstandard projections is specified by
+.I orient.
+Imagine a transparent gridded sphere around the globe.
+First turn the overlay about the North Pole
+so that the Prime Meridian (longitude 0)
+of the overlay coincides with meridian
+.I lon
+on the globe.
+Then tilt the North Pole of the
+overlay along its Prime Meridian to latitude
+.I lat
+on the globe.
+Finally again turn the
+overlay about its `North Pole' so
+that its Prime Meridian coincides with the previous position
+of (the overlay's) meridian
+.I rot.
+Project the desired map in
+the standard form appropriate to the overlay, but presenting
+information from the underlying globe.
+It is not useful to use
+.I orient
+without using
+.IR normalize .
+.PP
+.I Normalize
+converts latitude-longitude coordinates on the globe
+to coordinates on the overlaid grid.
+The coordinates and their sines and cosines
+are input to
+.I normalize
+in a
+.B place
+structure.
+Transformed coordinates and their sines and cosines
+are returned in the same structure.
+.PP
+.EX
+.nr xx \w'12345678'
+.ta \n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu
+	struct place {
+		double radianlat, sinlat, coslat;
+		double radianlon, sinlon, coslon;
+	};
+.EE
+.PP
+The projection generators
+return a pointer to a function that converts normalized coordinates
+to 
+.I x-y
+coordinates for the desired map, or
+0 if the required projection
+is not available.
+The returned function is exemplified by
+.I proj 
+in this example:
+.PP
+.EX
+.ta \n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu
+	struct place pt;
+	int (*proj)() = mercator();
+	double x, y;
+.EE
+.PP
+.EX
+	orient(45.0, 30.0, 180.0);	/* set coordinate rotation */
+.EE
+.PP
+.EX
+	. . .				/* fill in the pt structure */
+	normalize(&pt);			/* rotate coordinates */
+	if((*proj)(&pt, &x, &y) > 0)	/* project onto x,y plane */
+		plot(x, y);
+.EE
+.PP
+The projection function
+.B (*proj)()
+returns 1 for a good point,
+0 for a point on a wrong
+sheet (e.g. the back of the world in a perspective
+projection), and \-1 for a point that is deemed
+unplottable (e.g. points near the poles on a Mercator projection).
+.PP
+Scaling may be determined from the
+.I x-y
+coordinates of
+selected points.
+Latitudes and longitudes are measured in degrees for
+ease of specification for
+.I orient 
+and the projection generators
+but in radians for ease of calculation 
+for
+.I normalize
+and
+.I proj.
+In either case
+latitude is measured positive north of the equator,
+and longitude positive west of Greenwich.
+Radian longitude should be limited to the range
+.if t .I \-\(*p\(<=lon<\(*p.
+.if n .I -pi <= lon < pi.
+.PP
+Projection generators have the same names and the same
+arguments as the projections named in
+.IR map (1).
+All arguments are
+.BR double .
+.SH "SEE ALSO
+.IR map (1), 
+.IR map (5), 
+.SH BUGS
+Only one projection and one orientation can be active at a time.
+.br
+The west-longitude-positive convention
+betrays Yankee chauvinism.
+.SH COPYRIGHT
+.PP
+Copyright (C) 1998, Lucent Technologies
+.br
+All rights reserved
diff --git a/src/doug/doc/map.3.ps b/src/doug/doc/map.3.ps
new file mode 100644
index 0000000..181a02d
--- /dev/null
+++ b/src/doug/doc/map.3.ps
@@ -0,0 +1,396 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Sat Dec 20 11:27:27 2003
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%+ font Courier
+%%+ font Symbol
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%+ font Symbol-Slanted
+%%Pages: 2
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Symbol
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+%%IncludeResource: font Courier
+%%BeginResource: font Symbol-Slanted
+%%DocumentNeededResources: font Symbol
+/MakeTransformedFont{
+findfont dup maxlength dict begin
+{
+exch dup dup/FID ne exch/UniqueID ne and{
+exch def
+}{
+pop pop
+}ifelse
+}forall
+/FontBBox
+currentdict/FontBBox get
+4 array copy def
+FontBBox aload pop
+4 index transform 4 2 roll
+4 index transform 4 2 roll
+FontBBox astore pop
+FontMatrix exch matrix concatmatrix
+/FontMatrix exch def
+dup/FontName exch def
+currentdict end
+definefont pop
+}bind def
+/Symbol-Slanted
+[.89 0.0 15.5 dup sin exch cos div .89 0.0 0.0]
+/Symbol
+MakeTransformedFont
+%%EndResource
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Courier at 0 ENC0/Courier RE/Times-Italic at 0 ENC0/Times-Italic RE
+/Times-Bold at 0 ENC0/Times-Bold RE/Times-Roman at 0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283329204d4150283329>72 48 R/F1
+10.95/Times-Bold at 0 SF -.219<4e41>72 84 S<4d45>.219 E F0
+<6f7269656e742c206e6f726d616c697a6520ad206d61702070726f6a656374696f6e73>
+108 96 Q F1<53594e4f50534953>72 112.8 Q/F2 10/Times-Bold at 0 SF<6f7269656e
+7428646f75626c65206c61742c20646f75626c65206c6f6e2c20646f75626c652072>108
+124.8 Q<6f7429>-.18 E
+<6e6f726d616c697a652873747275637420706c616365202a7029>108 141.6 Q F1
+<4445534352495054494f4e>72 158.4 Q F0 1.282<5468652066756e6374696f6e73>
+108 170.4 R/F3 10/Times-Italic at 0 SF<6f7269656e74>4.012 E F0<616e64>4.462
+E F3<6e6f726d616c697a65>4.142 E F0 1.281<706c7573206120636f6c6c65637469
+6f6e206f66206d61702070726f6a656374696f6e2067656e657261746f72732061726520
+6c6f61646564206279206f7074696f6e>3.962 F F2<2d6c6d6170>108 182.4 Q F0
+<6f66>2.69 E F3<6c64>2.69 E F0 2.69<2831292e204d6f7374>.77 F .19<6f6620
+7468656d2063616c63756c617465206d61707320666f7220612073706865726963616c20
+65617274682e>2.69 F .191
+<45616368206d61702070726f6a656374696f6e2069732061>5.191 F -.25<7661>-.2
+G .191<696c61626c6520696e206f6e65>.25 F<7374616e6461726420666f726d2c2069
+6e746f2077686963682064617461206d757374206265206e6f726d616c697a656420666f
+72207472616e7376>108 194.4 Q
+<65727365206f72206e6f6e706f6c61722070726f6a656374696f6e732e>-.15 E .739<
+45616368207374616e646172642070726f6a656374696f6e20697320646973706c617965
+64207769746820746865205072696d65204d6572696469616e20286c6f6e676974756465
+203029206265696e6720612073747261696768742076>108 211.2 R .739
+<6572746963616c206c696e652c>-.15 F 1.584
+<616c6f6e67207768696368204e6f7274682069732075702e>108 223.2 R 1.584<5468
+65206f7269656e746174696f6e206f66206e6f6e7374616e646172642070726f6a656374
+696f6e732069732073706563698c6564206279>6.584 F F3<6f7269656e742e>4.314 E
+F0 1.584<496d6167696e652061>6.584 F .547<7472616e73706172656e7420677269
+64646564207370686572652061726f756e642074686520676c6f62652e>108 235.2 R
+.547<4669727374207475726e20746865206f>5.547 F -.15<7665>-.15 G .547<726c
+61792061626f757420746865204e6f72746820506f6c6520736f20746861742074686520
+5072696d65>.15 F .204
+<4d6572696469616e20286c6f6e676974756465203029206f6620746865206f>108
+247.2 R -.15<7665>-.15 G .204
+<726c617920636f696e63696465732077697468206d6572696469616e>.15 F F3
+<6c6f6e>2.794 E F0 .205<6f6e2074686520676c6f62652e>2.944 F .205
+<5468656e2074696c7420746865204e6f72746820506f6c65206f66>5.205 F .816
+<746865206f>108 259.2 R -.15<7665>-.15 G .816<726c617920616c6f6e67206974
+73205072696d65204d6572696469616e20746f206c61746974756465>.15 F F3
+<6c6174>3.406 E F0 .816<6f6e2074686520676c6f62652e>3.996 F .815
+<46696e616c6c79206167>5.815 F .815<61696e207475726e20746865206f>-.05 F
+-.15<7665>-.15 G .815<726c61792061626f757420697473>.15 F .207<604e6f7274
+6820506f6c652720736f207468617420697473205072696d65204d6572696469616e2063
+6f696e636964657320776974682074686520707265>108 271.2 R .207
+<76696f757320706f736974696f6e206f662028746865206f>-.25 F -.15<7665>-.15
+G<726c617927>.15 E .207<7329206d6572696469616e>-.55 F F3 -.45<726f>2.707
+G<742e>.45 E F0 .115<50726f6a656374207468652064657369726564206d61702069
+6e20746865207374616e6461726420666f726d20617070726f70726961746520746f2074
+6865206f>108 283.2 R -.15<7665>-.15 G<726c6179>.15 E 2.614<2c62>-.65 G
+.114
+<75742070726573656e74696e6720696e666f726d6174696f6e2066726f6d20746865>
+-2.814 F<756e6465726c79696e6720676c6f62652e>108 295.2 Q
+<4974206973206e6f742075736566756c20746f20757365>5 E F3<6f7269656e74>2.73
+E F0<776974686f7574207573696e67>3.18 E F3<6e6f726d616c697a65>2.5 E F0
+<2e>.18 E F3<4e6f726d616c697a65>108.7 312 Q F0<636f6e>3.967 E -.15<7665>
+-.4 G 1.288<727473206c617469747564652d6c6f6e67697475646520636f6f7264696e
+61746573206f6e2074686520676c6f626520746f20636f6f7264696e61746573206f6e20
+746865206f>.15 F -.15<7665>-.15 G 1.288<726c61696420677269642e>.15 F
+<546865>6.288 E 1.07<636f6f7264696e6174657320616e642074686569722073696e
+657320616e6420636f73696e65732061726520696e70757420746f>108 324 R F3
+<6e6f726d616c697a65>3.93 E F0 1.07<696e2061>3.75 F F2<706c616365>3.57 E
+F0 3.57<7374727563747572652e2054>3.57 F 1.07
+<72616e73666f726d656420636f6f7264692d>-.35 F<6e6174657320616e6420746865
+69722073696e657320616e6420636f73696e6573206172652072657475726e656420696e
+207468652073616d65207374727563747572652e>108 336 Q/F4 10/Courier at 0 SF
+<73747275637420706c616365207b>156 352.8 Q
+<646f75626c652072616469616e6c61742c2073696e6c61742c20636f736c61743b>204
+364.8 Q
+<646f75626c652072616469616e6c6f6e2c2073696e6c6f6e2c20636f736c6f6e3b>204
+376.8 Q<7d3b>156 388.8 Q F0 .344<5468652070726f6a656374696f6e2067656e65
+7261746f72732072657475726e206120706f696e74657220746f20612066756e6374696f
+6e207468617420636f6e>108 405.6 R -.15<7665>-.4 G .345
+<727473206e6f726d616c697a656420636f6f7264696e6174657320746f>.15 F F3
+<782d79>3.615 E F0<636f6f7264692d>3.165 E .235<6e6174657320666f72207468
+652064657369726564206d61702c206f7220302069662074686520726571756972656420
+70726f6a656374696f6e206973206e6f742061>108 417.6 R -.25<7661>-.2 G 2.734
+<696c61626c652e20546865>.25 F .234
+<72657475726e65642066756e6374696f6e2069732065>2.734 F -.15<7865>-.15 G
+<6d706c692d>.15 E<8c6564206279>108 429.6 Q F3<7072>3.75 E<6f6a>-.45 E F0
+<696e20746869732065>2.98 E<78616d706c653a>-.15 E F4
+<73747275637420706c6163652070743b>156 446.4 Q
+<696e7420282a70726f6a292829203d206d65726361746f7228293b>156 458.4 Q
+<646f75626c6520782c20793b>156 470.4 Q
+<6f7269656e742834352e302c2033302e302c203138302e30293b>156 487.2 Q
+<2f2a2073657420636f6f7264696e61746520726f746174696f6e202a2f>36 E 144 6
+<2e2e2e202f>156 504 T 6<2a66>-6 G
+<696c6c20696e2074686520707420737472756374757265202a2f>-6 E 96
+<6e6f726d616c697a6528267074293b202f2a>156 516 R
+<726f7461746520636f6f7264696e61746573202a2f>6 E
+<696628282a70726f6a29282670742c2026782c20267929203e203029>156 528 Q
+<2f2a2070726f6a656374206f6e746f20782c7920706c616e65202a2f>24 E
+<706c6f7428782c2079293b>204 540 Q F0 .108
+<5468652070726f6a656374696f6e2066756e6374696f6e>108 556.8 R F2<282a7072>
+2.608 E<6f6a292829>-.18 E F0 .108<72657475726e73203120666f72206120676f6f
+6420706f696e742c203020666f72206120706f696e74206f6e20612077726f6e67207368
+6565742028652e672e20746865206261636b206f66>2.608 F .925<7468652077>108
+568.8 R .925<6f726c6420696e206120706572737065637469>-.1 F 1.225 -.15
+<76652070>-.25 H .925<726f6a656374696f6e292c20616e6420ad3120666f72206120
+706f696e742074686174206973206465656d656420756e706c6f747461626c652028652e
+672e20706f696e7473206e65617220746865>.15 F
+<706f6c6573206f6e2061204d65726361746f722070726f6a656374696f6e292e>108
+580.8 Q .418
+<5363616c696e67206d61792062652064657465726d696e65642066726f6d20746865>
+108 597.6 R F3<782d79>3.688 E F0 .418
+<636f6f7264696e61746573206f662073656c656374656420706f696e74732e>3.238 F
+.418<4c617469747564657320616e64206c6f6e6769747564657320617265206d65612d>
+5.418 F .426<737572656420696e206465>108 609.6 R .426
+<677265657320666f722065617365206f662073706563698c636174696f6e20666f72>
+-.15 F F3<6f7269656e74>3.156 E F0 .425
+<616e64207468652070726f6a656374696f6e2067656e657261746f72732062>3.606 F
+.425<757420696e2072616469616e7320666f722065617365206f66>-.2 F 1.015
+<63616c63756c6174696f6e20666f72>108 621.6 R F3<6e6f726d616c697a65>3.875
+E F0<616e64>3.695 E F3<7072>4.765 E<6f6a2e>-.45 E F0 1.016<496e20656974
+6865722063617365206c61746974756465206973206d6561737572656420706f73697469>
+6.015 F 1.316 -.15<7665206e>-.25 H 1.016
+<6f727468206f66207468652065717561746f72>.15 F 3.516<2c61>-.4 G<6e64>
+-3.516 E<6c6f6e67697475646520706f73697469>108 633.6 Q .3 -.15<76652077>
+-.25 H<657374206f6620477265656e776963682e>.15 E<52616469616e206c6f6e6769
+747564652073686f756c64206265206c696d6974656420746f207468652072616e6765>5
+E F3<ad>2.14 E/F5 10/Symbol-Slanted SF<70>A/F6 10/Symbol SF<a3>A F3
+<6c6f6e3c>A F5<70>A F3<2e>A F0 1.014
+<50726f6a656374696f6e2067656e657261746f7273206861>108 650.4 R 1.314 -.15
+<76652074>-.2 H 1.013
+<68652073616d65206e616d657320616e64207468652073616d65206172>.15 F 1.013
+<67756d656e7473206173207468652070726f6a656374696f6e73206e616d656420696e>
+-.18 F F3<6d6170>3.513 E F0<2831292e>.19 E<416c6c206172>108 662.4 Q
+<67756d656e747320617265>-.18 E F2<646f75626c65>2.5 E F0<2e>A F1
+<53454520414c534f>72 679.2 Q F3<6d6170>108 691.2 Q F0<2831292c>.19 E F3
+<6d6170>2.5 E F0<2835292c>.19 E<31>535 768 Q 0 Cg EP
+%%Page: 2 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283329204d4150283329>72 48 R/F1
+10.95/Times-Bold at 0 SF -.11<4255>72 84 S<4753>.11 E F0<4f6e6c79206f6e6520
+70726f6a656374696f6e20616e64206f6e65206f7269656e746174696f6e2063616e2062
+652061637469>108 96 Q .3 -.15<76652061>-.25 H 2.5<746174>.15 G<696d652e>
+-2.5 E<54686520776573742d6c6f6e6769747564652d706f73697469>108 108 Q .3
+-.15<76652063>-.25 H<6f6e>.15 E -.15<7665>-.4 G
+<6e74696f6e20626574726179732059>.15 E<616e6b>-1 E
+<6565206368617576696e69736d2e>-.1 E F1<434f50595249474854>72 124.8 Q F0
+<436f70>108 136.8 Q<7972696768742028432920313939382c204c7563656e742054>
+-.1 E<6563686e6f6c6f67696573>-.7 E<416c6c2072696768747320726573657276>
+108 148.8 Q<6564>-.15 E<32>535 768 Q 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/src/doug/doc/map.5 b/src/doug/doc/map.5
new file mode 100644
index 0000000..6f8e733
--- /dev/null
+++ b/src/doug/doc/map.5
@@ -0,0 +1,89 @@
+.so tmac.anx
+.TH MAP 5
+.SH NAME
+map \- digitized map formats
+.SH DESCRIPTION
+Files used by
+.IR  map (1)
+are a sequence of structures of the form:
+.PP
+.EX
+struct {
+	signed char patchlatitude;
+	signed char patchlongitude;
+	short n;
+	union {
+		struct {
+			short latitude;
+			short longitude;
+		} point[n];
+		struct {
+			short latitude;
+			short longitude;
+			struct {
+				signed char latdiff;
+				signed char londiff;
+			} point[\-n];
+		} highres;
+	} segment;
+};
+.EE
+.PP
+Fields
+.L patchlatitude
+and
+.L patchlongitude
+tell to what
+10-degree by 10-degree
+patch of the earth's surface a segment belongs.
+Their values range from \-9 to 8 and from \-18 to 17,
+respectively, and indicate the coordinates of the
+southeast corner of the patch in units of 10 degrees.
+.PP
+Each segment of
+.RB | n |
+points is connected; consecutive segments
+are not necessarily related.
+Latitude and longitude
+are measured in units of 0.0001 radian.
+If
+.B n
+is negative, then
+differences to the first and succeeding points
+are measured in units of 0.00001 radian.
+Latitude is counted positive to the north and
+longitude positive to the west.
+.PP
+The patches are ordered lexicographically by
+.L patchlatitude
+then
+.LR patchlongitude .
+A printable
+index to the first segment of each patch
+in a file named
+.I data
+is kept in an associated file named
+.IB data .x .
+Each line of an index file contains
+.L patchlatitude,
+.L patchlongitude
+and the byte position
+of the patch
+in the map file.
+Both the map file and the index file are ordered by
+patch latitude and longitude.
+.PP
+Shorts are stored in little-endian order, low byte first, 
+regardless of computer architecture.
+To assure portability,
+.I map
+accesses them bytewise.
+.SH "SEE ALSO"
+.IR map (1),
+.IR map (3),
+.IR ascii2map (1)
+.SH COPYRIGHT
+.PP
+Copyright (C) 1998, Lucent Technologies
+.br
+All rights reserved
diff --git a/src/doug/doc/map.5.ps b/src/doug/doc/map.5.ps
new file mode 100644
index 0000000..69e322d
--- /dev/null
+++ b/src/doug/doc/map.5.ps
@@ -0,0 +1,299 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Sat Dec 20 11:27:27 2003
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%+ font Courier
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 1
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+%%IncludeResource: font Courier
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Courier at 0 ENC0/Courier RE/Times-Italic at 0 ENC0/Times-Italic RE
+/Times-Bold at 0 ENC0/Times-Bold RE/Times-Roman at 0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF 398.84<4d4150283529204d4150283529>72 48 R/F1
+10.95/Times-Bold at 0 SF -.219<4e41>72 84 S<4d45>.219 E F0
+<6d617020ad206469676974697a6564206d617020666f726d617473>108 96 Q F1
+<4445534352495054494f4e>72 112.8 Q F0<46696c65732075736564206279>108
+124.8 Q/F2 10/Times-Italic at 0 SF<6d6170>2.5 E F0<283129206172652061207365
+7175656e6365206f662073747275637475726573206f662074686520666f726d3a>.19 E
+/F3 10/Courier at 0 SF<737472756374207b>108 141.6 Q
+<7369676e656420636861722070617463686c617469747564653b>144 153.6 Q
+<7369676e656420636861722070617463686c6f6e6769747564653b>144 165.6 Q
+<73686f7274206e3b>144 177.6 Q<756e696f6e207b>144 189.6 Q
+<737472756374207b>180 201.6 Q<73686f7274206c617469747564653b>216 213.6 Q
+<73686f7274206c6f6e6769747564653b>216 225.6 Q 6<7d70>180 237.6 S
+<6f696e745b6e5d3b>-6 E<737472756374207b>180 249.6 Q
+<73686f7274206c617469747564653b>216 261.6 Q
+<73686f7274206c6f6e6769747564653b>216 273.6 Q<737472756374207b>216 285.6
+Q<7369676e65642063686172206c6174646966663b>252 297.6 Q
+<7369676e65642063686172206c6f6e646966663b>252 309.6 Q 6<7d70>216 321.6 S
+<6f696e745bad6e5d3b>-6 E 6<7d68>180 333.6 S<6967687265733b>-6 E 6<7d73>
+144 345.6 S<65676d656e743b>-6 E<7d3b>108 357.6 Q F0<4669656c6473>108
+374.4 Q/F4 10/Times-Bold at 0 SF<70617463686c61746974756465>2.72 E F0
+<616e64>2.72 E F4<70617463686c6f6e676974756465>2.72 E F0 .22
+<74656c6c20746f20776861742031302d6465>2.72 F .22
+<677265652062792031302d6465>-.15 F .22
+<67726565207061746368206f662074686520656172746827>-.15 F 2.72<7373>-.55
+G<757266>-2.72 E .22<6163652061>-.1 F<7365>108 386.4 Q .382
+<676d656e742062656c6f6e67732e>-.15 F .382<54686569722076>5.382 F .383<61
+6c7565732072616e67652066726f6d20ad3920746f203820616e642066726f6d20ad3138
+20746f2031372c207265737065637469>-.25 F -.15<7665>-.25 G<6c79>.15 E
+2.883<2c61>-.65 G .383<6e6420696e6469636174652074686520636f6f72>-2.883 F
+<2d>-.2 E<64696e61746573206f662074686520736f7574686561737420636f726e6572
+206f662074686520706174636820696e20756e697473206f66203130206465>108 398.4
+Q<67726565732e>-.15 E 1.302<45616368207365>108 415.2 R 1.302
+<676d656e74206f66207c>-.15 F F4<6e>A F0 3.802<7c70>C 1.302
+<6f696e747320697320636f6e6e65637465643b20636f6e736563757469>-3.802 F
+1.601 -.15<76652073>-.25 H -.15<6567>.15 G 1.301
+<6d656e747320617265206e6f74206e65636573736172696c792072656c617465642e>
+.15 F 1.301<4c6174697475646520616e64>6.301 F .255<6c6f6e6769747564652061
+7265206d6561737572656420696e20756e697473206f6620302e30303031207261646961
+6e2e>108 427.2 R<4966>5.255 E F4<6e>2.756 E F0 .256<6973206e65>2.756 F
+-.05<6761>-.15 G<7469>.05 E -.15<7665>-.25 G 2.756<2c74>.15 G .256
+<68656e20646966>-2.756 F .256
+<666572656e63657320746f20746865208c72737420616e6420737563636565642d>-.25
+F .437<696e6720706f696e747320617265206d6561737572656420696e20756e697473
+206f6620302e30303030312072616469616e2e>108 439.2 R .437
+<4c6174697475646520697320636f756e74656420706f73697469>5.437 F .737 -.15
+<76652074>-.25 H 2.937<6f74>.15 G .437
+<6865206e6f72746820616e64206c6f6e676974756465>-2.937 F<706f73697469>108
+451.2 Q .3 -.15<76652074>-.25 H 2.5<6f74>.15 G<686520776573742e>-2.5 E
+.33<546865207061746368657320617265206f726465726564206c65>108 468 R .331
+<7869636f67726170686963616c6c79206279>-.15 F F4
+<70617463686c61746974756465>2.831 E F0<7468656e>2.831 E F4
+<70617463686c6f6e676974756465>2.831 E F0 5.331<2e41>C .331
+<7072696e7461626c6520696e6465>-2.5 F 2.831<7874>-.15 G 2.831<6f74>-2.831
+G<6865>-2.831 E .349<8c727374207365>108 480 R .349
+<676d656e74206f66206561636820706174636820696e2061208c6c65206e616d6564>
+-.15 F F2<64617461>3.199 E F0 .349<6973206b>3.109 F .348
+<65707420696e20616e206173736f636961746564208c6c65206e616d6564>-.1 F F2
+<64617461>2.848 E F4<2e78>.26 E F2<2e>.23 E F0 .348
+<45616368206c696e65206f6620616e>5.348 F<696e6465>108 492 Q 2.998<788c>
+-.15 G .498<6c6520636f6e7461696e73>-2.998 F F4 .498
+<70617463686c617469747564652c2070617463686c6f6e676974756465>2.998 F F0
+.499<616e6420746865206279746520706f736974696f6e206f66207468652070617463
+6820696e20746865206d6170208c6c652e>2.999 F<426f7468>5.499 E
+<746865206d6170208c6c6520616e642074686520696e6465>108 504 Q 2.5<788c>
+-.15 G<6c6520617265206f726465726564206279207061746368206c61746974756465
+20616e64206c6f6e6769747564652e>-2.5 E .342<53686f727473206172652073746f
+72656420696e206c6974746c652d656e6469616e206f72646572>108 520.8 R 2.842
+<2c6c>-.4 G .842 -.25<6f772062>-2.842 H .342<797465208c7273742c207265>
+.25 F -.05<6761>-.15 G .342
+<72646c657373206f6620636f6d7075746572206172636869746563747572652e>.05 F
+1.942 -.8<546f2061>5.342 H .342<737375726520706f7274612d>.8 F
+<62696c697479>108 532.8 Q<2c>-.65 E F2<6d6170>2.88 E F0
+<6163636573736573207468656d2062797465>2.69 E<776973652e>-.25 E F1
+<53454520414c534f>72 549.6 Q F2<6d6170>108 561.6 Q F0<2831292c>.19 E F2
+<6d6170>2.5 E F0<2833292c>.19 E F2<6173636969326d6170>2.5 E F0<283129>
+.19 E F1<434f50595249474854>72 578.4 Q F0<436f70>108 590.4 Q
+<7972696768742028432920313939382c204c7563656e742054>-.1 E
+<6563686e6f6c6f67696573>-.7 E<416c6c2072696768747320726573657276>108
+602.4 Q<6564>-.15 E<31>535 768 Q 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/src/doug/doc/route.1 b/src/doug/doc/route.1
new file mode 100644
index 0000000..0732792
--- /dev/null
+++ b/src/doug/doc/route.1
@@ -0,0 +1,44 @@
+.TH ROUTE 1
+.SH NAME
+route \- identify great circle between two points
+.SH SYNOPSIS
+.B route
+[
+.B -t
+]
+.SH DESCRIPTION
+.I Route
+repeatedly
+reads two latitude-longitude pairs (white-space punctuation)
+from standard input.  With no option,
+it places on standard output
+.B -o
+options for
+.IR map (1)
+that will place the equator of the tilted, rotated
+coordinate system along the great circle from point
+A to point B (west to east) and from B to A.
+With each option it also gives
+the coordinates of the two
+points in the new coordinate system, thus giving
+the extent of a strip map of the great circle route
+(useful for setting limits with the
+.B -w
+option to 
+.IR map ).
+.PP
+Under option 
+.B -t
+.I route
+produces a sequence of points along the great circle,
+useful for a
+.B -t 
+track for 
+.IR map .
+.SH "SEE ALSO
+.IR map (1)
+.SH COPYRIGHT
+.PP
+Copyright (C) 1998, Lucent Technologies
+.br
+All rights reserved
diff --git a/src/doug/doc/route.1.ps b/src/doug/doc/route.1.ps
new file mode 100644
index 0000000..c803c76
--- /dev/null
+++ b/src/doug/doc/route.1.ps
@@ -0,0 +1,255 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Sat Dec 20 11:27:27 2003
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 1
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic at 0 ENC0/Times-Italic RE/Times-Bold at 0 ENC0/Times-Bold RE
+/Times-Roman at 0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman at 0 SF -.4<524f>72 48 S 376.32<5554452831292052>.4 F
+<4f555445283129>-.4 E/F1 10.95/Times-Bold at 0 SF -.219<4e41>72 84 S<4d45>
+.219 E F0<726f75746520ad206964656e7469667920677265617420636972636c652062
+65747765656e207477>108 96 Q 2.5<6f70>-.1 G<6f696e7473>-2.5 E F1
+<53594e4f50534953>72 112.8 Q/F2 10/Times-Bold at 0 SF -.18<726f>108 124.8 S
+<757465>.18 E F0<5b>2.5 E F2<2d74>2.5 E F0<5d>2.5 E F1
+<4445534352495054494f4e>72 141.6 Q/F3 10/Times-Italic at 0 SF<526f757465>
+108.63 153.6 Q F0 1.095<72657065617465646c79207265616473207477>3.775 F
+3.595<6f6c>-.1 G 1.094<617469747564652d6c6f6e67697475646520706169727320
+2877686974652d73706163652070756e6374756174696f6e292066726f6d207374616e64
+61726420696e7075742e>-3.595 F -.4<5769>6.094 G<7468>.4 E .141<6e6f206f70
+74696f6e2c20697420706c61636573206f6e207374616e64617264206f7574707574>108
+165.6 R F2<2d6f>2.641 E F0 .142<6f7074696f6e7320666f72>2.641 F F3
+<6d6170>2.642 E F0 .142<28312920746861742077696c6c20706c6163652074686520
+65717561746f72206f66207468652074696c7465642c20726f7461746564>.19 F .183<
+636f6f7264696e6174652073797374656d20616c6f6e6720746865206772656174206369
+72636c652066726f6d20706f696e74204120746f20706f696e7420422028776573742074
+6f20656173742920616e642066726f6d204220746f20412e>108 177.6 R -.4<5769>
+5.183 G .183<74682065616368>.4 F .137
+<6f7074696f6e20697420616c736f206769>108 189.6 R -.15<7665>-.25 G 2.638
+<7374>.15 G .138<686520636f6f7264696e61746573206f6620746865207477>-2.638
+F 2.638<6f70>-.1 G .138<6f696e747320696e20746865206e65>-2.638 F 2.638
+<7763>-.25 G .138<6f6f7264696e6174652073797374656d2c2074687573206769>
+-2.638 F .138<76696e67207468652065>-.25 F .138<7874656e74206f66>-.15 F
+2.5<6173>108 201.6 S<74726970206d6170206f662074686520677265617420636972
+636c6520726f757465202875736566756c20666f722073657474696e67206c696d697473
+207769746820746865>-2.5 E F2<2d77>2.5 E F0<6f7074696f6e20746f>2.5 E F3
+<6d6170>2.5 E F0<292e>.19 E<556e646572206f7074696f6e>108 218.4 Q F2
+<2d74>2.5 E F3 -.45<726f>2.5 G<757465>.45 E F0<70726f647563657320612073
+657175656e6365206f6620706f696e747320616c6f6e6720746865206772656174206369
+72636c652c2075736566756c20666f722061>2.68 E F2<2d74>2.5 E F0
+<747261636b20666f72>2.5 E F3<6d6170>2.5 E F0<2e>.19 E F1
+<53454520414c534f>72 235.2 Q F3<6d6170>108 247.2 Q F0<283129>.19 E F1
+<434f50595249474854>72 264 Q F0<436f70>108 276 Q
+<7972696768742028432920313939382c204c7563656e742054>-.1 E
+<6563686e6f6c6f67696573>-.7 E<416c6c2072696768747320726573657276>108 288
+Q<6564>-.15 E<31>535 768 Q 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/src/doug/doc/tmac.anx b/src/doug/doc/tmac.anx
new file mode 100644
index 0000000..f96f6af
--- /dev/null
+++ b/src/doug/doc/tmac.anx
@@ -0,0 +1,18 @@
+.fp 5 CW
+.de L
+.B \\$1 \\$2 \\$3
+..
+.de  LR
+.BR \\$1 \\$2 \\$3 \\$4 \\$5 \\$6
+..
+.de  RL
+.RB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6
+..
+.de EX
+.if t .ft 5
+.nf 
+..
+.de EE
+.ft 1
+.fi 
+..
diff --git a/src/doug/index.c b/src/doug/index.c
new file mode 100644
index 0000000..7480535
--- /dev/null
+++ b/src/doug/index.c
@@ -0,0 +1,96 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+		/* p0+=0; shuts off warnings */
+static proj Yaitoff(double p0,double p1){p0+=0;p1+=0;return aitoff();}
+static proj Yalbers(double p0,double p1){return albers(p0,p1);}
+static proj Yazequalarea(double p0,double p1){p0+=0;p1+=0;return azequalarea();}
+static proj Yazequidistant(double p0,double p1){p0+=0;p1+=0;return azequidistant();}
+static proj Ybicentric(double p0,double p1){p1+=0;return bicentric(p0);}
+static proj Ybonne(double p0,double p1){p1+=0;return bonne(p0);}
+static proj Yconic(double p0,double p1){p1+=0;return conic(p0);}
+static proj Ycylequalarea(double p0,double p1){p1+=0;return cylequalarea(p0);}
+static proj Ycylindrical(double p0,double p1){p0+=0;p1+=0;return cylindrical();}
+static proj Yeisenlohr(double p0,double p1){p0+=0;p1+=0;return eisenlohr();}
+static proj Yelliptic(double p0,double p1){p1+=0;return elliptic(p0);}
+static proj Yfisheye(double p0,double p1){p1+=0;return fisheye(p0);}
+static proj Ygall(double p0,double p1){p1+=0;return gall(p0);}
+static proj Ygilbert(double p0,double p1){p0+=0;p1+=0;return gilbert();}
+static proj Yglobular(double p0,double p1){p0+=0;p1+=0;return globular();}
+static proj Ygnomonic(double p0,double p1){p0+=0;p1+=0;return gnomonic();}
+static proj Yguyou(double p0,double p1){p0+=0;p1+=0;return guyou();}
+static proj Yharrison(double p0,double p1){return harrison(p0,p1);}
+static proj Yhex(double p0,double p1){p0+=0;p1+=0;return hex();}
+static proj Yhoming(double p0,double p1){p1+=0;return homing(p0);}
+static proj Ylagrange(double p0,double p1){p0+=0;p1+=0;return lagrange();}
+static proj Ylambert(double p0,double p1){return lambert(p0,p1);}
+static proj Ylaue(double p0,double p1){p0+=0;p1+=0;return laue();}
+static proj Ylune(double p0,double p1){return lune(p0,p1);}
+static proj Ymecca(double p0,double p1){p1+=0;return mecca(p0);}
+static proj Ymercator(double p0,double p1){p0+=0;p1+=0;return mercator();}
+static proj Ymollweide(double p0,double p1){p0+=0;p1+=0;return mollweide();}
+static proj Ynewyorker(double p0,double p1){p1+=0;return newyorker(p0);}
+static proj Yorthographic(double p0,double p1){p0+=0;p1+=0;return orthographic();}
+static proj Yperspective(double p0,double p1){p1+=0;return perspective(p0);}
+static proj Ypolyconic(double p0,double p1){p0+=0;p1+=0;return polyconic();}
+static proj Yrectangular(double p0,double p1){p1+=0;return rectangular(p0);}
+static proj Ysimpleconic(double p0,double p1){return simpleconic(p0,p1);}
+static proj Ysinusoidal(double p0,double p1){p0+=0;p1+=0;return sinusoidal();}
+static proj Ysp_albers(double p0,double p1){return sp_albers(p0,p1);}
+static proj Ysp_mercator(double p0,double p1){p0+=0;p1+=0;return sp_mercator();}
+static proj Ysquare(double p0,double p1){p0+=0;p1+=0;return square();}
+static proj Ystereographic(double p0,double p1){p0+=0;p1+=0;return stereographic();}
+static proj Ytetra(double p0,double p1){p0+=0;p1+=0;return tetra();}
+static proj Ytrapezoidal(double p0,double p1){return trapezoidal(p0,p1);}
+static proj Yvandergrinten(double p0,double p1){p0+=0;p1+=0;return vandergrinten();}
+
+struct pindex pindex[] = {	/* index of projections */
+	{"aitoff", Yaitoff, 0, picut, 0, 0, 0},
+	{"albers", Yalbers, 2, picut, 3, 0, 0},
+	{"azequalarea", Yazequalarea, 0, nocut, 1, 0, 0},
+	{"azequidistant", Yazequidistant, 0, nocut, 1, 0, 0},
+	{"bicentric", Ybicentric, 1, nocut, 0, 0, 0},
+	{"bonne", Ybonne, 1, picut, 0, 0, 0},
+	{"conic", Yconic, 1, picut, 0, 0, 0},
+	{"cylequalarea", Ycylequalarea, 1, picut, 3, 0, 0},
+	{"cylindrical", Ycylindrical, 0, picut, 0, 0, 0},
+	{"eisenlohr", Yeisenlohr, 0, picut, 0, 0, 0},
+	{"elliptic", Yelliptic, 1, nocut, 0, 0, 0},
+	{"fisheye", Yfisheye, 1, nocut, 0, 0, 0},
+	{"gall", Ygall, 1, picut, 3, 0, 0},
+	{"gilbert", Ygilbert, 0, picut, 0, 0, 0},
+	{"globular", Yglobular, 0, picut, 0, 0, 0},
+	{"gnomonic", Ygnomonic, 0, nocut, 0, 0, plimb},
+	{"guyou", Yguyou, 0, guycut, 0, 0, 0},
+	{"harrison", Yharrison, 2, nocut, 0, 0, plimb},
+	{"hex", Yhex, 0, hexcut, 0, 0, 0},
+	{"homing", Yhoming, 1, nocut, 3, 0, hlimb},
+	{"lagrange", Ylagrange,0,picut,0, 0, 0},
+	{"lambert", Ylambert, 2, picut, 0, 0, 0},
+	{"laue", Ylaue, 0, nocut, 0, 0, 0},
+	{"lune", Ylune, 2, nocut, 0, 0, 0},
+	{"mecca", Ymecca, 1, picut, 3, 0, mlimb},
+	{"mercator", Ymercator, 0, picut, 3, 0, 0},
+	{"mollweide", Ymollweide, 0, picut, 0, 0, 0},
+	{"newyorker", Ynewyorker, 1, nocut, 0, 0, 0},
+	{"orthographic", Yorthographic, 0, nocut, 0, 0, olimb},
+	{"perspective", Yperspective, 1, nocut, 0, 0, plimb},
+	{"polyconic", Ypolyconic, 0, picut, 0, 0, 0},
+	{"rectangular", Yrectangular, 1, picut, 3, 0, 0},
+	{"simpleconic", Ysimpleconic, 2, picut, 3, 0, 0},
+	{"sinusoidal", Ysinusoidal, 0, picut, 0, 0, 0},
+	{"sp_albers", Ysp_albers, 2, picut, 3, 1, 0},
+	{"sp_mercator", Ysp_mercator, 0, picut, 0, 1, 0},
+	{"square", Ysquare, 0, picut, 0, 0, 0},
+	{"stereographic", Ystereographic, 0, nocut, 0, 0, 0},
+	{"tetra", Ytetra, 0, tetracut, 0, 0, 0},
+	{"trapezoidal", Ytrapezoidal, 2, picut, 3, 0, 0},
+	{"vandergrinten", Yvandergrinten, 0, picut, 0, 0, 0},
+	{0}
+};
diff --git a/src/doug/iplot.h b/src/doug/iplot.h
new file mode 100644
index 0000000..d887c61
--- /dev/null
+++ b/src/doug/iplot.h
@@ -0,0 +1,74 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+/* Plotting functions for v8 and v9 systems */
+/* This file is an alternative to plot.h */
+
+#define SOLID "solid"
+#define DOTTED "dotted"
+#define DASHED "dashed"
+#define DOTDASH "dotdash"
+
+/* open the plotting output */
+#define openpl()  printf("o\n")
+
+/* close the plotting output */
+#define closepl()  printf("cl\n")
+
+/* make sure the page or screen is clear */
+#define erase() printf("e\n")
+
+/* plot a point at _x,_y, which becomes current */
+#define point(_x,_y)  printf("poi %d %d\n", _x,_y)
+
+/* coordinates to be assigned to lower left and upper right
+   corners of (square) plotting area */
+#define range(_x,_y,_X,_Y)  printf("ra %d %d %d %d\n", _x,_y,_X,_Y)
+
+/* place text, first letter at current point, which does not change */
+#define text(_s)  {if(*(_s) == ' ')printf("t \"%s\"\n",_s); else printf("t %s\n", _s); }
+
+/* draw line from current point to _x,_y, which becomes current */
+#define vec(_x,_y)  printf("v %d %d\n", _x,_y)
+
+/* _x,_y becomes current point */
+#define move(_x, _y)  printf("m %d %d\n", _x, _y)
+
+/* specify style for drawing lines: "dotted", "solid", "dotdash" */
+#define pen(_s)  printf("pe %s\n", _s)
+
+#define comment(_s,_t)
+
+#define BLACK "black"
+#define RED "red"
+#define GREEN "green"
+#define BLUE "blue"
+
+static struct {
+	char *name;
+	char *hsbcode;
+} colors[] = {
+	BLACK, "0 0 0",
+	RED, "0 1 1",
+	GREEN, ".33 1 1",
+	BLUE, ".67 1 1"
+};
+
+static void
+color(char *s)
+{
+	char *t;
+	int i;
+	for(i=0; i<sizeof(colors)/sizeof(*colors); i++)
+		if(strcmp(s, colors[i].name) == 0)
+			s = colors[i].hsbcode;
+	while(t = strchr(s, ','))
+		*t = ' ';
+	printf("co \"%s\"\n",s);
+}
+
+#define colorcode(s) s
diff --git a/src/doug/libmap/Makefile b/src/doug/libmap/Makefile
new file mode 100644
index 0000000..d12a1a6
--- /dev/null
+++ b/src/doug/libmap/Makefile
@@ -0,0 +1,21 @@
+
+# .o's ordered for a nonrandom library
+OBJ= aitoff.o albers.o azequalarea.o elliptic.o azequidist.o  \
+bicentric.o bonne.o conic.o cylequalarea.o cylindrical.o eisenlohr.o fisheye.o \
+gall.o gilbert.o guyou.o harrison.o hex.o homing.o lagrange.o lambert.o \
+laue.o lune.o mercator.o mollweide.o newyorker.o polyconic.o simpleconic.o \
+sinusoidal.o tetra.o perspective.o orthographic.o trapezoidal.o \
+rectangular.o twocirc.o cuts.o ccubrt.o cubrt.o elco2.o complex.o zcoord.o 
+
+# ignore error on systems without ranlib
+
+libmap.a: ../map.h $(OBJ)
+	ar cr libmap.a $(OBJ)
+	ranlib libmap.a 2>/dev/null || true
+
+clean:
+	rm -f *.o libmap.a
+
+.SUFFIXES.: .c .o
+.c.o:
+	$(CC) $(CFLAGS) -I.. -c $*.c
diff --git a/src/doug/libmap/aitoff.c b/src/doug/libmap/aitoff.c
new file mode 100644
index 0000000..467eb36
--- /dev/null
+++ b/src/doug/libmap/aitoff.c
@@ -0,0 +1,31 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+#define Xaitwist Xaitpole.nlat
+static struct place Xaitpole;
+
+static int
+Xaitoff(struct place *place, double *x, double *y)
+{
+	struct place p;
+	copyplace(place,&p);
+	p.wlon.l /= 2.;
+	trig(&p.wlon);
+	norm(&p,&Xaitpole,&Xaitwist);
+	Xazequalarea(&p,x,y);
+	*x *= 2.;
+	return(1);
+}
+
+proj
+aitoff(void)
+{
+	latlon(0.,0.,&Xaitpole);
+	return(Xaitoff);
+}
diff --git a/src/albers.c b/src/doug/libmap/albers.c
similarity index 99%
copy from src/albers.c
copy to src/doug/libmap/albers.c
index fadbddc..795eae2 100644
--- a/src/albers.c
+++ b/src/doug/libmap/albers.c
@@ -12,7 +12,7 @@ All rights reserved
 
 static double r0sq, r1sq, d2, n, den, sinb1, sinb2;
 static struct coord plat1, plat2;
-static southpole;
+static int southpole;
 
 static double num(double s)
 {
diff --git a/src/doug/libmap/azequalarea.c b/src/doug/libmap/azequalarea.c
new file mode 100644
index 0000000..02a852d
--- /dev/null
+++ b/src/doug/libmap/azequalarea.c
@@ -0,0 +1,24 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int
+Xazequalarea(struct place *place, double *x, double *y)
+{
+	double r;
+	r = sqrt(1. - place->nlat.s);
+	*x = - r * place->wlon.s;
+	*y = - r * place->wlon.c;
+	return(1);
+}
+
+proj
+azequalarea(void)
+{
+	return(Xazequalarea);
+}
diff --git a/src/doug/libmap/azequidist.c b/src/doug/libmap/azequidist.c
new file mode 100644
index 0000000..ac868a3
--- /dev/null
+++ b/src/doug/libmap/azequidist.c
@@ -0,0 +1,24 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int
+Xazequidistant(struct place *place, double *x, double *y)
+{
+	double colat;
+	colat = PI/2 - place->nlat.l;
+	*x = -colat * place->wlon.s;
+	*y = -colat * place->wlon.c;
+	return(1);
+}
+
+proj
+azequidistant(void)
+{
+	return(Xazequidistant);
+}
diff --git a/src/doug/libmap/bicentric.c b/src/doug/libmap/bicentric.c
new file mode 100644
index 0000000..51a6c5c
--- /dev/null
+++ b/src/doug/libmap/bicentric.c
@@ -0,0 +1,30 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct coord center;
+
+static int
+Xbicentric(struct place *place, double *x, double *y)
+{
+	if(place->wlon.c<=.01||place->nlat.c<=.01)
+		return(-1);
+	*x = -center.c*place->wlon.s/place->wlon.c;
+	*y = place->nlat.s/(place->nlat.c*place->wlon.c);
+	return(*x**x+*y**y<=9);
+}
+
+proj
+bicentric(double l)
+{
+	l = fabs(l);
+	if(l>89)
+		return(0);
+	deg2rad(l,&center);
+	return(Xbicentric);
+}
diff --git a/src/doug/libmap/bonne.c b/src/doug/libmap/bonne.c
new file mode 100644
index 0000000..396f5f6
--- /dev/null
+++ b/src/doug/libmap/bonne.c
@@ -0,0 +1,41 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct coord stdpar;
+static double r0;
+
+static int
+Xbonne(struct place *place, double *x, double *y)
+{
+	double r, alpha;
+	r = r0 - place->nlat.l;
+	if(r<.001)
+		if(fabs(stdpar.c)<1e-10)
+			alpha = place->wlon.l;
+		else if(fabs(place->nlat.c)==0)
+			alpha = 0;
+		else 
+			alpha = place->wlon.l/(1+
+				stdpar.c*stdpar.c*stdpar.c/place->nlat.c/3);
+	else
+		alpha = place->wlon.l * place->nlat.c / r;
+	*x = - r*sin(alpha);
+	*y = - r*cos(alpha);
+	return(1);
+}
+
+proj
+bonne(double par)
+{
+	if(fabs(par*RAD) < .01)
+		return(Xsinusoidal);
+	deg2rad(par, &stdpar);
+	r0 = stdpar.c/stdpar.s + stdpar.l;
+	return(Xbonne);
+}
diff --git a/src/doug/libmap/ccubrt.c b/src/doug/libmap/ccubrt.c
new file mode 100644
index 0000000..abe185b
--- /dev/null
+++ b/src/doug/libmap/ccubrt.c
@@ -0,0 +1,18 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+void
+ccubrt(double zr, double zi, double *wr, double *wi)
+{
+	double r, theta;
+	theta = atan2(zi,zr);
+	r = cubrt(hypot(zr,zi));
+	*wr = r*cos(theta/3);
+	*wi = r*sin(theta/3);
+}
diff --git a/src/doug/libmap/complex.c b/src/doug/libmap/complex.c
new file mode 100644
index 0000000..4213ecf
--- /dev/null
+++ b/src/doug/libmap/complex.c
@@ -0,0 +1,89 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+/*complex divide, defensive against overflow from
+ *	* and /, but not from + and -
+ *	assumes underflow yields 0.0
+ *	uses identities:
+ *	(a + bi)/(c + di) = ((a + bd/c) + (b - ad/c)i)/(c + dd/c)
+ *	(a + bi)/(c + di) = (b - ai)/(d - ci)
+*/
+void
+cdiv(double a, double b, double c, double d, double *u, double *v)
+{
+	double r,t;
+	if(fabs(c)<fabs(d)) {
+		t = -c; c = d; d = t;
+		t = -a; a = b; b = t;
+	}
+	r = d/c;
+	t = c + r*d;
+	*u = (a + r*b)/t;
+	*v = (b - r*a)/t;
+}
+
+void
+cmul(double c1, double c2, double d1, double d2, double *e1, double *e2)
+{
+	*e1 = c1*d1 - c2*d2;
+	*e2 = c1*d2 + c2*d1;
+}
+
+void
+csq(double c1, double c2, double *e1, double *e2)
+{
+	*e1 = c1*c1 - c2*c2;
+	*e2 = c1*c2*2;
+}
+
+/* complex square root
+ *	assumes underflow yields 0.0
+ *	uses these identities:
+ *	sqrt(x+-iy) = sqrt(r(cos(t)+-i*sin(t))
+ *	           = sqrt(r)(cos(t/2)+-i*sin(t/2))
+ *	cos(t/2) = sin(t)/2sin(t/2) = sqrt((1+cos(t)/2)
+ *	sin(t/2) = sin(t)/2cos(t/2) = sqrt((1-cos(t)/2)
+*/
+void
+csqrt(double c1, double c2, double *e1, double *e2)
+{
+	double r,s;
+	double x,y;
+	x = fabs(c1);
+	y = fabs(c2);
+	if(x>=y) {
+		if(x==0) {
+			*e1 = *e2 = 0;
+			return;
+		}
+		r = x;
+		s = y/x;
+	} else {
+		r = y;
+		s = x/y;
+	}
+	r *= sqrt(1+ s*s);
+	if(c1>0) {
+		*e1 = sqrt((r+c1)/2);
+		*e2 = c2/(2* *e1);
+	} else {
+		*e2 = sqrt((r-c1)/2);
+		if(c2<0)
+			*e2 = -*e2;
+		*e1 = c2/(2* *e2);
+	}
+}
+
+void cpow(double c1, double c2, double *d1, double *d2, double pwr)
+{
+	double theta = pwr*atan2(c2,c1);
+	double r = pow(hypot(c1,c2), pwr);
+	*d1 = r*cos(theta);
+	*d2 = r*sin(theta);
+}
diff --git a/src/doug/libmap/conic.c b/src/doug/libmap/conic.c
new file mode 100644
index 0000000..d6feee9
--- /dev/null
+++ b/src/doug/libmap/conic.c
@@ -0,0 +1,32 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct coord stdpar;
+
+static int
+Xconic(struct place *place, double *x, double *y)
+{
+	double r;
+	if(fabs(place->nlat.l-stdpar.l) > 80.*RAD)
+		return(-1);
+	r = stdpar.c/stdpar.s - tan(place->nlat.l - stdpar.l);
+	*x = - r*sin(place->wlon.l * stdpar.s);
+	*y = - r*cos(place->wlon.l * stdpar.s);
+	if(r>3) return(0);
+	return(1);
+}
+
+proj
+conic(double par)
+{
+	if(fabs(par) <.1)
+		return(Xcylindrical);
+	deg2rad(par, &stdpar);
+	return(Xconic);
+}
diff --git a/src/doug/libmap/cubrt.c b/src/doug/libmap/cubrt.c
new file mode 100644
index 0000000..95543aa
--- /dev/null
+++ b/src/doug/libmap/cubrt.c
@@ -0,0 +1,35 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+double
+cubrt(double a)
+{
+	double x,y,x1;
+	if(a==0) 
+		return(0.);
+	y = 1;
+	if(a<0) {
+		y = -y;
+		a = -a;
+	}
+	while(a<1) {
+		a *= 8;
+		y /= 2;
+	}
+	while(a>1) {
+		a /= 8;
+		y *= 2;
+	}
+	x = 1;
+	do {
+		x1 = x;
+		x = (2*x1+a/(x1*x1))/3;
+	} while(fabs(x-x1)>10.e-15);
+	return(x*y);
+}
diff --git a/src/cuts.c b/src/doug/libmap/cuts.c
similarity index 82%
copy from src/cuts.c
copy to src/doug/libmap/cuts.c
index e3b8a19..db4fb40 100644
--- a/src/cuts.c
+++ b/src/doug/libmap/cuts.c
@@ -22,7 +22,7 @@ are included to make the libary self-standing.*/
 int
 picut(struct place *g, struct place *og, double *cutlon)
 {
-	g; og; cutlon;
+	g=g; og=og; cutlon=cutlon;	/* avoid warnings */
 	abort();
 	return 0;
 }
@@ -30,18 +30,15 @@ picut(struct place *g, struct place *og, double *cutlon)
 int
 ckcut(struct place *g1, struct place *g2, double lon)
 {
-	g1; g2; lon;
+	g1=g1; g2=g2; lon=lon;
 	abort();
 	return 0;
 }
 
-/* minka: from map.c */
 double
-reduce(double lon)
+reduce(double x)
 {
-        if(lon>PI)
-                lon -= 2*PI;
-        else if(lon<-PI)
-                lon += 2*PI;
-        return(lon);
+	x=x;
+	abort();
+	return 0;
 }
diff --git a/src/doug/libmap/cylequalarea.c b/src/doug/libmap/cylequalarea.c
new file mode 100644
index 0000000..b1193ce
--- /dev/null
+++ b/src/doug/libmap/cylequalarea.c
@@ -0,0 +1,29 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double a;
+
+static int
+Xcylequalarea(struct place *place, double *x, double *y)
+{
+	*x = - place->wlon.l * a;
+	*y = place->nlat.s;
+	return(1);
+}
+
+proj
+cylequalarea(double par)
+{
+	struct coord stdp0;
+	if(par > 89.0)
+		return(0);
+	deg2rad(par, &stdp0);
+	a = stdp0.c*stdp0.c;
+	return(Xcylequalarea);
+}
diff --git a/src/doug/libmap/cylindrical.c b/src/doug/libmap/cylindrical.c
new file mode 100644
index 0000000..5a2fe2f
--- /dev/null
+++ b/src/doug/libmap/cylindrical.c
@@ -0,0 +1,24 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int
+Xcylindrical(struct place *place, double *x, double *y)
+{
+	if(fabs(place->nlat.l) > 80.*RAD)
+		return(-1);
+	*x = - place->wlon.l;
+	*y = place->nlat.s / place->nlat.c;
+	return(1);
+}
+
+proj
+cylindrical(void)
+{
+	return(Xcylindrical);
+}
diff --git a/src/doug/libmap/eisenlohr.c b/src/doug/libmap/eisenlohr.c
new file mode 100644
index 0000000..de6bbe7
--- /dev/null
+++ b/src/doug/libmap/eisenlohr.c
@@ -0,0 +1,24 @@
+#include "map.h"
+
+int 
+Xeisenlohr(struct place *p, double *x, double *y)
+{
+	double s1 = -sin(p->wlon.l/2);
+	double c1 = cos(p->wlon.l/2);
+	double s2 = sin(p->nlat.l/2);
+	double c2 = cos(p->nlat.l/2);
+	double t = s2/(c2+sqrt(2*p->nlat.c)*c1);
+	double c = sqrt(2/(1+t*t));
+	double q = sqrt(p->nlat.c/2);
+	double v = sqrt((c2+q*(c1+s1))/(c2+q*(c1-s1)));
+	double vi = 1/v;
+	*x = -2*log(v) + c*(v-vi);
+	*y = -2*atan(t) + c*t*(v+vi);
+	return 1;
+}
+
+proj
+eisenlohr()
+{
+	return Xeisenlohr;
+}
diff --git a/src/doug/libmap/elco2.c b/src/doug/libmap/elco2.c
new file mode 100644
index 0000000..4321073
--- /dev/null
+++ b/src/doug/libmap/elco2.c
@@ -0,0 +1,137 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+/* elliptic integral routine, R.Bulirsch,
+ *	Numerische Mathematik 7(1965) 78-90
+ *	calculate integral from 0 to x+iy of
+ *	(a+b*t^2)/((1+t^2)*sqrt((1+t^2)*(1+kc^2*t^2)))
+ *	yields about D valid figures, where CC=10e-D
+ *	for a*b>=0, except at branchpoints x=0,y=+-i,+-i/kc;
+ *	there the accuracy may be reduced.
+ *	fails for kc=0 or x<0
+ *	return(1) for success, return(0) for fail
+ *
+ *	special case a=b=1 is equivalent to
+ *	standard elliptic integral of first kind
+ *	from 0 to atan(x+iy) of
+ *	1/sqrt(1-k^2*(sin(t))^2) where k^2=1-kc^2
+*/
+
+#define ROOTINF 10.e18
+#define CC 1.e-6
+
+int
+elco2(double x, double y, double kc, double a, double b, double *u, double *v)
+{
+	double c,d,dn1,dn2,e,e1,e2,f,f1,f2,h,k,m,m1,m2,sy;
+	double d1[13],d2[13];
+	int i,l;
+	if(kc==0||x<0)
+		return(0);
+	sy = y>0? 1: y==0? 0: -1;
+	y = fabs(y);
+	csq(x,y,&c,&e2);
+	d = kc*kc;
+	k = 1-d;
+	e1 = 1+c;
+	cdiv2(1+d*c,d*e2,e1,e2,&f1,&f2);
+	f2 = -k*x*y*2/f2;
+	csqr(f1,f2,&dn1,&dn2);
+	if(f1<0) {
+		f1 = dn1;
+		dn1 = -dn2;
+		dn2 = -f1;
+	}
+	if(k<0) {
+		dn1 = fabs(dn1);
+		dn2 = fabs(dn2);
+	}
+	c = 1+dn1;
+	cmul(e1,e2,c,dn2,&f1,&f2);
+	cdiv(x,y,f1,f2,&d1[0],&d2[0]);
+	h = a-b;
+	d = f = m = 1;
+	kc = fabs(kc);
+	e = a;
+	a += b;
+	l = 4;
+	for(i=1;;i++) {
+		m1 = (kc+m)/2;
+		m2 = m1*m1;
+		k *= f/(m2*4);
+		b += e*kc;
+		e = a;
+		cdiv2(kc+m*dn1,m*dn2,c,dn2,&f1,&f2);
+		csqr(f1/m1,k*dn2*2/f2,&dn1,&dn2);
+		cmul(dn1,dn2,x,y,&f1,&f2);
+		x = fabs(f1);
+		y = fabs(f2);
+		a += b/m1;
+		l *= 2;
+		c = 1 +dn1;
+		d *= k/2;
+		cmul(x,y,x,y,&e1,&e2);
+		k *= k;
+
+		cmul(c,dn2,1+e1*m2,e2*m2,&f1,&f2);
+		cdiv(d*x,d*y,f1,f2,&d1[i],&d2[i]);
+		if(k<=CC) 
+			break;
+		kc = sqrt(m*kc);
+		f = m2;
+		m = m1;
+	}
+	f1 = f2 = 0;
+	for(;i>=0;i--) {
+		f1 += d1[i];
+		f2 += d2[i];
+	}
+	x *= m1;
+	y *= m1;
+	cdiv2(1-y,x,1+y,-x,&e1,&e2);
+	e2 = x*2/e2;
+	d = a/(m1*l);
+	*u = atan2(e2,e1);
+	if(*u<0)
+		*u += PI;
+	a = d*sy/2;
+	*u = d*(*u) + f1*h;
+	*v = (-1-log(e1*e1+e2*e2))*a + f2*h*sy + a;
+	return(1);
+}
+
+void
+cdiv2(double c1, double c2, double d1, double d2, double *e1, double *e2)
+{
+	double t;
+	if(fabs(d2)>fabs(d1)) {
+		t = d1, d1 = d2, d2 = t;
+		t = c1, c1 = c2, c2 = t;
+	}
+	if(fabs(d1)>ROOTINF)
+		*e2 = ROOTINF*ROOTINF;
+	else
+		*e2 = d1*d1 + d2*d2;
+	t = d2/d1;
+	*e1 = (c1+t*c2)/(d1+t*d2); /* (c1*d1+c2*d2)/(d1*d1+d2*d2) */
+}
+
+/* complex square root of |x|+iy */
+void
+csqr(double c1, double c2, double *e1, double *e2)
+{
+	double r2;
+	r2 = c1*c1 + c2*c2;
+	if(r2<=0) {
+		*e1 = *e2 = 0;
+		return;
+	}
+	*e1 = sqrt((sqrt(r2) + fabs(c1))/2);
+	*e2 = c2/(*e1*2);
+}
diff --git a/src/doug/libmap/elliptic.c b/src/doug/libmap/elliptic.c
new file mode 100644
index 0000000..68735f8
--- /dev/null
+++ b/src/doug/libmap/elliptic.c
@@ -0,0 +1,42 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct coord center;
+
+static int
+Xelliptic(struct place *place, double *x, double *y)
+{
+	double r1,r2;
+	r1 = acos(trigclamp(
+		place->nlat.c*(place->wlon.c*center.c
+		- place->wlon.s*center.s)));
+	r2 = acos(trigclamp(
+		place->nlat.c*(place->wlon.c*center.c
+		+ place->wlon.s*center.s)));
+	*x = -(r1*r1 - r2*r2)/(4*center.l);
+	*y = (r1*r1+r2*r2)/2 - (center.l*center.l+*x**x);
+	if(*y < 0)
+		*y = 0;
+	*y = sqrt(*y);
+	if(place->nlat.l<0)
+		*y = -*y;
+	return(1);
+}
+
+proj
+elliptic(double l)
+{
+	l = fabs(l);
+	if(l>89)
+		return(0);
+	if(l<1)
+		return(Xazequidistant);
+	deg2rad(l,&center);
+	return(Xelliptic);
+}
diff --git a/src/doug/libmap/fisheye.c b/src/doug/libmap/fisheye.c
new file mode 100644
index 0000000..c37db04
--- /dev/null
+++ b/src/doug/libmap/fisheye.c
@@ -0,0 +1,31 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+/* refractive fisheye, not logarithmic */
+
+static double n;
+
+static int
+Xfisheye(struct place *place, double *x, double *y)
+{
+	double r;
+	double u = sin(PI/4-place->nlat.l/2)/n;
+	if(fabs(u) > .97)
+		return -1;
+	r = tan(asin(u));
+	*x = -r*place->wlon.s;
+	*y = -r*place->wlon.c;
+	return 1;
+}
+
+proj
+fisheye(double par)
+{
+	n = par;
+	return n<.1? 0: Xfisheye;
+}
diff --git a/src/doug/libmap/gall.c b/src/doug/libmap/gall.c
new file mode 100644
index 0000000..ec38693
--- /dev/null
+++ b/src/doug/libmap/gall.c
@@ -0,0 +1,34 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double scale;
+
+static int
+Xgall(struct place *place, double *x, double *y)
+{
+	/* two ways to compute tan(place->nlat.l/2) */
+	if(fabs(place->nlat.s)<.1)
+		*y = sin(place->nlat.l/2)/cos(place->nlat.l/2);
+	else
+		*y = (1-place->nlat.c)/place->nlat.s;
+	*x = -scale*place->wlon.l;
+	return 1;
+}
+
+proj
+gall(double par)
+{
+	double coshalf;
+	if(fabs(par)>80)
+		return 0;
+	par *= RAD;
+	coshalf = cos(par/2);
+	scale = cos(par)/(2*coshalf*coshalf);
+	return Xgall;
+}
diff --git a/src/doug/libmap/gilbert.c b/src/doug/libmap/gilbert.c
new file mode 100644
index 0000000..ca1d798
--- /dev/null
+++ b/src/doug/libmap/gilbert.c
@@ -0,0 +1,56 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int
+Xgilbert(struct place *p, double *x, double *y)
+{
+/* the interesting part - map the sphere onto a hemisphere */
+	struct place q;
+	q.nlat.s = tan(0.5*(p->nlat.l));
+	if(q.nlat.s > 1) q.nlat.s = 1;
+	if(q.nlat.s < -1) q.nlat.s = -1;
+	q.nlat.c = sqrt(1 - q.nlat.s*q.nlat.s);
+	q.wlon.l = p->wlon.l/2;
+	trig(&q.wlon);
+/* the dull part: present the hemisphere orthogrpahically */
+	*y = q.nlat.s;
+	*x = -q.wlon.s*q.nlat.c;
+	return(1);
+}
+
+proj
+gilbert(void)
+{
+	return(Xgilbert);
+}
+
+/* derivation of the interesting part:
+   map the sphere onto the plane by stereographic projection;
+   map the plane onto a half plane by sqrt;
+   map the half plane back to the sphere by stereographic
+   projection
+
+   n,w are original lat and lon
+   r is stereographic radius
+   primes are transformed versions
+
+   r = cos(n)/(1+sin(n))
+   r' = sqrt(r) = cos(n')/(1+sin(n'))
+
+   r'^2 = (1-sin(n')^2)/(1+sin(n')^2) = cos(n)/(1+sin(n))
+
+   this is a linear equation for sin n', with solution
+
+   sin n' = (1+sin(n)-cos(n))/(1+sin(n)+cos(n))
+
+   use standard formula: tan x/2 = (1-cos x)/sin x = sin x/(1+cos x)
+   to show that the right side of the last equation is tan(n/2)
+*/
+
+
diff --git a/src/doug/libmap/guyou.c b/src/doug/libmap/guyou.c
new file mode 100644
index 0000000..fbd25cb
--- /dev/null
+++ b/src/doug/libmap/guyou.c
@@ -0,0 +1,106 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct place gywhem, gyehem;
+static struct coord gytwist;
+static double gyconst, gykc, gyside;
+
+
+static void
+dosquare(double z1, double z2, double *x, double *y)
+{
+	double w1,w2;
+	w1 = z1 -1;
+	if(fabs(w1*w1+z2*z2)>.000001) {
+		cdiv(z1+1,z2,w1,z2,&w1,&w2);
+		w1 *= gyconst;
+		w2 *= gyconst;
+		if(w1<0)
+			w1 = 0;
+		elco2(w1,w2,gykc,1.,1.,x,y);
+	} else {
+		*x = gyside;
+		*y = 0;
+	}
+}
+
+int
+Xguyou(struct place *place, double *x, double *y)
+{
+	int ew;		/*which hemisphere*/
+	double z1,z2;
+	struct place pl;
+	ew = place->wlon.l<0;
+	copyplace(place,&pl);
+	norm(&pl,ew?&gyehem:&gywhem,&gytwist);
+	Xstereographic(&pl,&z1,&z2);
+	dosquare(z1/2,z2/2,x,y);
+	if(!ew)
+		*x -= gyside;
+	return(1);
+}
+
+proj
+guyou(void)
+{
+	double junk;
+	gykc = 1/(3+2*sqrt(2.));
+	gyconst = -(1+sqrt(2.));
+	elco2(-gyconst,0.,gykc,1.,1.,&gyside,&junk);
+	gyside *= 2;
+	latlon(0.,90.,&gywhem);
+	latlon(0.,-90.,&gyehem);
+	deg2rad(0.,&gytwist);
+	return(Xguyou);
+}
+
+int
+guycut(struct place *g, struct place *og, double *cutlon)
+{
+	int c;
+	c = picut(g,og,cutlon);
+	if(c!=1)
+		return(c);
+	*cutlon = 0.;
+	if(g->nlat.c<.7071||og->nlat.c<.7071)
+		return(ckcut(g,og,0.));
+	return(1);
+}
+
+static int
+Xsquare(struct place *place, double *x, double *y)
+{
+	double z1,z2;
+	double r, theta;
+	struct place p;
+	copyplace(place,&p);
+	if(place->nlat.l<0) {
+		p.nlat.l = -p.nlat.l;
+		p.nlat.s = -p.nlat.s;
+	}
+	if(p.nlat.l<FUZZ && fabs(p.wlon.l)>PI-FUZZ){
+		*y = -gyside/2;
+		*x = p.wlon.l>0?0:gyside;
+		return(1);
+	}
+	Xstereographic(&p,&z1,&z2);
+	r = sqrt(sqrt(hypot(z1,z2)/2));
+	theta = atan2(z1,-z2)/4;
+	dosquare(r*sin(theta),-r*cos(theta),x,y);
+	if(place->nlat.l<0)
+		*y = -gyside - *y;
+	return(1);
+}
+
+proj
+square(void)
+{
+	guyou();
+	return(Xsquare);
+}
diff --git a/src/doug/libmap/harrison.c b/src/doug/libmap/harrison.c
new file mode 100644
index 0000000..c0494ab
--- /dev/null
+++ b/src/doug/libmap/harrison.c
@@ -0,0 +1,45 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double v3,u2,u3,a,b; /*v=view,p=obj,u=unit.y*/
+
+static int
+Xharrison(struct place *place, double *x, double *y)
+{
+	double p1 = -place->nlat.c*place->wlon.s;
+	double p2 = -place->nlat.c*place->wlon.c;
+	double p3 = place->nlat.s;
+	double d = b + u3*p2 - u2*p3;
+	double t;
+	if(d < .01)
+		return -1;
+	t = a/d;
+	if(v3*place->nlat.s < 1.)
+		return -1;
+	*y = t*p2*u2 + (v3-t*(v3-p3))*u3;
+	*x = t*p1;
+	if(t < 0)
+		return 0;
+	if(*x * *x + *y * *y > 16)
+		return -1;
+	return 1;
+}
+
+proj
+harrison(double r, double alpha)
+{
+	u2 = cos(alpha*RAD);
+	u3 = sin(alpha*RAD);
+	v3 = r;
+	b = r*u2;
+	a = 1 + b;
+	if(r<1.001 || a<sqrt(r*r-1))
+		return 0;
+	return Xharrison;
+}
diff --git a/src/doug/libmap/hex.c b/src/doug/libmap/hex.c
new file mode 100644
index 0000000..ba89f8e
--- /dev/null
+++ b/src/doug/libmap/hex.c
@@ -0,0 +1,128 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+#define BIG 1.e15
+#define HFUZZ .0001
+
+static double hcut[3] ;
+static double kr[3] = { .5, -1., .5 };
+static double ki0[3] = { -1., 0., 1. };
+static double ki[3];   /*ki0*sqrt(3)/2*/
+static double cr[3];
+static double ci[3];
+static struct place hem;
+static struct coord twist;
+static double  rootroot3, hkc;
+static double w2;
+static double rootk;
+
+static void
+reflect(int i, double wr, double wi, double *x, double *y)
+{
+	double pr,pi,l;
+	pr = cr[i]-wr;
+	pi = ci[i]-wi;
+	l = 2*(kr[i]*pr + ki[i]*pi);
+	*x = wr + l*kr[i];
+	*y = wi + l*ki[i];
+}
+
+static int
+Xhex(struct place *place, double *x, double *y)
+{
+	int ns;
+	int i;
+	double zr,zi;
+	double sr,si,tr,ti,ur,ui,vr,vi,yr,yi;
+	struct place p;
+	copyplace(place,&p);
+	ns = place->nlat.l >= 0;
+	if(!ns) {
+		p.nlat.l = -p.nlat.l;
+		p.nlat.s = -p.nlat.s;
+	}
+	if(p.nlat.l<HFUZZ) {
+		for(i=0;i<3;i++)
+			if(fabs(reduce(p.wlon.l-hcut[i]))<HFUZZ) {
+				if(i==2) {
+					*x = 2*cr[0] - cr[1];
+					*y = 0;
+				} else {
+					*x = cr[1];
+					*y = 2*ci[2*i];
+				}
+				return(1);
+			}
+		p.nlat.l = HFUZZ;
+		trig(&p.nlat);
+	}
+	norm(&p,&hem,&twist);
+	Xstereographic(&p,&zr,&zi);
+	zr /= 2;
+	zi /= 2;
+	cdiv(1-zr,-zi,1+zr,zi,&sr,&si);
+	csq(sr,si,&tr,&ti);
+	ccubrt(1+3*tr,3*ti,&ur,&ui);
+	csqrt(ur-1,ui,&vr,&vi);
+	cdiv(rootroot3+vr,vi,rootroot3-vr,-vi,&yr,&yi);
+	yr /= rootk;
+	yi /= rootk;
+	elco2(fabs(yr),yi,hkc,1.,1.,x,y);
+	if(yr < 0)
+		*x = w2 - *x;
+	if(!ns) reflect(hcut[0]>place->wlon.l?0:
+			hcut[1]>=place->wlon.l?1:
+			2,*x,*y,x,y);
+	return(1);
+}
+
+proj
+hex(void)
+{
+	int i;
+	double t;
+	double root3;
+	double c,d;
+	struct place p;
+	hcut[2] = PI;
+	hcut[1] = hcut[2]/3;
+	hcut[0] = -hcut[1];
+	root3 = sqrt(3.);
+	rootroot3 = sqrt(root3);
+	t = 15 -8*root3;
+	hkc = t*(1-sqrt(1-1/(t*t)));
+	elco2(BIG,0.,hkc,1.,1.,&w2,&t);
+	w2 *= 2;
+	rootk = sqrt(hkc);
+	latlon(90.,90.,&hem);
+	latlon(90.,0.,&p);
+	Xhex(&p,&c,&t);
+	latlon(0.,0.,&p);
+	Xhex(&p,&d,&t);
+	for(i=0;i<3;i++) {
+		ki[i] = ki0[i]*root3/2;
+		cr[i] = c + (c-d)*kr[i];
+		ci[i] = (c-d)*ki[i];
+	}
+	deg2rad(0.,&twist);
+	return(Xhex);
+}
+
+int
+hexcut(struct place *g, struct place *og, double *cutlon)
+{
+	int t,i;
+	if(g->nlat.l>=-HFUZZ&&og->nlat.l>=-HFUZZ)
+		return(1);
+	for(i=0;i<3;i++) {
+		t = ckcut(g,og,*cutlon=hcut[i]);
+		if(t!=1) return(t);
+	}
+	return(1);
+}
diff --git a/src/doug/libmap/homing.c b/src/doug/libmap/homing.c
new file mode 100644
index 0000000..5912134
--- /dev/null
+++ b/src/doug/libmap/homing.c
@@ -0,0 +1,120 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct coord p0;		/* standard parallel */
+
+int first;
+
+static struct coord az;		/* azimuth of p0 seen from place */
+static struct coord rad;	/* angular dist from place to p0 */
+
+static int
+azimuth(struct place *place)
+{
+	if(place->nlat.c < FUZZ) {
+		az.l = PI/2 + place->nlat.l - place->wlon.l;
+		trig(&az);
+		rad.l = fabs(place->nlat.l - p0.l);
+		if(rad.l > PI)
+			rad.l = 2*PI - rad.l;
+		trig(&rad);
+		return 1;
+	}
+	rad.c = trigclamp(p0.s*place->nlat.s +	/* law of cosines */
+		p0.c*place->nlat.c*place->wlon.c);
+	rad.s = sqrt(1 - rad.c*rad.c);
+	if(fabs(rad.s) < .001) {
+		az.s = 0;
+		az.c = 1;
+	} else {
+		az.s = trigclamp(p0.c*place->wlon.s/rad.s); /* sines */
+		az.c = trigclamp((p0.s - rad.c*place->nlat.s)
+				/(rad.s*place->nlat.c));
+	}
+	rad.l = atan2(rad.s, rad.c);
+	return 1;
+}
+
+static int
+Xmecca(struct place *place, double *x, double *y)
+{
+	if(!azimuth(place))
+		return 0;
+	*x = -place->wlon.l;
+	*y = fabs(az.s)<.02? -az.c*rad.s/p0.c: *x*az.c/az.s;
+	return fabs(*y)>2? -1:
+	       rad.c<0? 0:
+	       1;
+}
+
+proj
+mecca(double par)
+{
+	first = 1;
+	if(fabs(par)>80.)
+		return(0);
+	deg2rad(par,&p0);
+	return(Xmecca);
+}
+
+static int
+Xhoming(struct place *place, double *x, double *y)
+{
+	if(!azimuth(place))
+		return 0;
+	*x = -rad.l*az.s;
+	*y = -rad.l*az.c;
+	return place->wlon.c<0? 0: 1;
+}
+
+proj
+homing(double par)
+{
+	first = 1;
+	if(fabs(par)>80.)
+		return(0);
+	deg2rad(par,&p0);
+	return(Xhoming);
+}
+
+int
+hlimb(double *lat, double *lon, double res)
+{
+	if(first) {
+		*lon = -90;
+		*lat = -90;
+		first = 0;
+		return 0;
+	}
+	*lat += res;
+	if(*lat <= 90) 
+		return 1;
+	if(*lon == 90)
+		return -1;
+	*lon = 90;
+	*lat = -90;
+	return 0;
+}
+
+int
+mlimb(double *lat, double *lon, double res)
+{
+	int ret = !first;
+	if(fabs(p0.s) < .01)
+		return -1;
+	if(first) {
+		*lon = -180;
+		first = 0;
+	} else
+		*lon += res;
+	if(*lon > 180)
+		return -1;
+	*lat = atan(-cos(*lon*RAD)/p0.s*p0.c)/RAD;
+	return ret;
+}
diff --git a/src/doug/libmap/lagrange.c b/src/doug/libmap/lagrange.c
new file mode 100644
index 0000000..f86b816
--- /dev/null
+++ b/src/doug/libmap/lagrange.c
@@ -0,0 +1,35 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static int
+Xlagrange(struct place *place, double *x, double *y)
+{
+	double z1,z2;
+	double w1,w2,t1,t2;
+	struct place p;
+	copyplace(place,&p);
+	if(place->nlat.l<0) {
+		p.nlat.l = -p.nlat.l;
+		p.nlat.s = -p.nlat.s;
+	}
+	Xstereographic(&p,&z1,&z2);
+	csqrt(-z2/2,z1/2,&w1,&w2);
+	cdiv(w1-1,w2,w1+1,w2,&t1,&t2);
+	*y = -t1;
+	*x = t2;
+	if(place->nlat.l<0)
+		*y = -*y;
+	return(1);
+}
+
+proj
+lagrange(void)
+{
+	return(Xlagrange);
+}
diff --git a/src/lambert.c b/src/doug/libmap/lambert.c
similarity index 77%
copy from src/lambert.c
copy to src/doug/libmap/lambert.c
index 7fb3e0d..c0e8d69 100644
--- a/src/lambert.c
+++ b/src/doug/libmap/lambert.c
@@ -41,13 +41,18 @@ lambert(double par0, double par1)
 	deg2rad(par1, &stdp1);
 	if(fabs(par1+par0)<.1) 
 		return(mercator());
-	if(fabs(par0)>89.5||fabs(par1)>89.5)
-		return(0);
+	if(fabs(par1)>89.5) {
+		if(par0>89.5)
+			return(perspective(-1.));
+		else if(par0<-89.5)
+			return 0;	/* S pole stereographic */
+		else
+			return 0;
+	}
 	if(fabs(par1-par0)<.1)
-	  /* series expansion about stdp1.s = stdp0.s */
-	  k = stdp0.s + 0.5*(stdp1.s - stdp0.s);
-	else 
-	  k = 2*log(stdp1.c/stdp0.c)/log(
-		(1+stdp0.s)*(1-stdp1.s)/((1-stdp0.s)*(1+stdp1.s)));
+		k = stdp0.s;
+	else
+		k = 2*log(stdp1.c/stdp0.c)/log(
+		  (1+stdp0.s)*(1-stdp1.s)/((1-stdp0.s)*(1+stdp1.s)));
 	return(Xlambert);
 }
diff --git a/src/doug/libmap/laue.c b/src/doug/libmap/laue.c
new file mode 100644
index 0000000..e17ae0f
--- /dev/null
+++ b/src/doug/libmap/laue.c
@@ -0,0 +1,29 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+
+static int
+Xlaue(struct place *place, double *x, double *y)
+{
+	double r;
+	if(place->nlat.l<PI/4+FUZZ)
+		return(-1);
+	r = tan(PI-2*place->nlat.l);
+	if(r>3)
+		return(-1);
+	*x = - r * place->wlon.s;
+	*y = - r * place->wlon.c;
+	return(1);
+}
+
+proj
+laue(void)
+{
+	return(Xlaue);
+}
diff --git a/src/doug/libmap/lune.c b/src/doug/libmap/lune.c
new file mode 100644
index 0000000..43428a1
--- /dev/null
+++ b/src/doug/libmap/lune.c
@@ -0,0 +1,67 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int Xstereographic(struct place *place, double *x, double *y);
+
+static struct place eastpole;
+static struct place westpole;
+static double eastx, easty;
+static double westx, westy;
+static double scale;
+static double pwr;
+
+/* conformal map w = ((1+z)^A - (1-z)^A)/((1+z)^A + (1-z)^A),
+   where A<1, maps unit circle onto a convex lune with x= +-1
+   mapping to vertices of angle A*PI at w = +-1 */
+
+/* there are cuts from E and W poles to S pole,
+   in absence of a cut routine, error is returned for
+   points outside a polar cap through E and W poles */
+
+static int Xlune(struct place *place, double *x, double *y)
+{
+	double stereox, stereoy;
+	double z1x, z1y, z2x, z2y;
+	double w1x, w1y, w2x, w2y;
+	double numx, numy, denx, deny;
+	if(place->nlat.l < eastpole.nlat.l-FUZZ)
+		return	-1;
+	Xstereographic(place, &stereox, &stereoy);
+	stereox *= scale;
+	stereoy *= scale;
+	z1x = 1 + stereox;
+	z1y = stereoy;
+	z2x = 1 - stereox;
+	z2y = -stereoy;
+	cpow(z1x,z1y,&w1x,&w1y,pwr);
+	cpow(z2x,z2y,&w2x,&w2y,pwr);
+	numx = w1x - w2x;
+	numy = w1y - w2y;
+	denx = w1x + w2x;
+	deny = w1y + w2y;
+	cdiv(numx, numy, denx, deny, x, y);
+	return 1;
+}	
+
+proj
+lune(double lat, double theta)
+{
+	deg2rad(lat, &eastpole.nlat);
+	deg2rad(-90.,&eastpole.wlon);
+	deg2rad(lat, &westpole.nlat);
+	deg2rad(90. ,&westpole.wlon);
+	Xstereographic(&eastpole, &eastx, &easty);
+	Xstereographic(&westpole, &westx, &westy);
+	if(fabs(easty)>FUZZ || fabs(westy)>FUZZ ||
+	   fabs(eastx+westx)>FUZZ)
+		abort();
+	scale = 1/eastx;
+	pwr = theta/180;
+	return Xlune;
+}
diff --git a/src/doug/libmap/mercator.c b/src/doug/libmap/mercator.c
new file mode 100644
index 0000000..13aa787
--- /dev/null
+++ b/src/doug/libmap/mercator.c
@@ -0,0 +1,41 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static int
+Xmercator(struct place *place, double *x, double *y)
+{
+	if(fabs(place->nlat.l) > 80.*RAD)
+		return(-1);
+	*x = -place->wlon.l;
+	*y = 0.5*log((1+place->nlat.s)/(1-place->nlat.s));
+	return(1);
+}
+
+proj
+mercator(void)
+{
+	return(Xmercator);
+}
+
+static double ecc = ECC;
+
+static int
+Xspmercator(struct place *place, double *x, double *y)
+{
+	if(Xmercator(place,x,y) < 0)
+		return(-1);
+	*y += 0.5*ecc*log((1-ecc*place->nlat.s)/(1+ecc*place->nlat.s));
+	return(1);
+}
+
+proj
+sp_mercator(void)
+{
+	return(Xspmercator);
+}
diff --git a/src/doug/libmap/mollweide.c b/src/doug/libmap/mollweide.c
new file mode 100644
index 0000000..05b9fca
--- /dev/null
+++ b/src/doug/libmap/mollweide.c
@@ -0,0 +1,30 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static int
+Xmollweide(struct place *place, double *x, double *y)
+{
+	double z;
+	double w;
+	z = place->nlat.l;
+	if(fabs(z)<89.9*RAD)
+		do {	/*newton for 2z+sin2z=pi*sin(lat)*/
+			w = (2*z+sin(2*z)-PI*place->nlat.s)/(2+2*cos(2*z));
+			z -= w;
+		} while(fabs(w)>=.00001);
+	*y = sin(z);
+	*x = - (2/PI)*cos(z)*place->wlon.l;
+	return(1);
+}
+
+proj
+mollweide(void)
+{
+	return(Xmollweide);
+}
diff --git a/src/doug/libmap/newyorker.c b/src/doug/libmap/newyorker.c
new file mode 100644
index 0000000..06072a7
--- /dev/null
+++ b/src/doug/libmap/newyorker.c
@@ -0,0 +1,33 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double a;
+
+static int
+Xnewyorker(struct place *place, double *x, double *y)
+{
+	double r = PI/2 - place->nlat.l;
+	double s;
+	if(r<.001)	/* cheat to plot center */
+		s = 0;
+	else if(r<a)
+		return -1;
+	else
+		s = log(r/a);
+	*x = -s * place->wlon.s;
+	*y = -s * place->wlon.c;
+	return(1);
+}
+
+proj
+newyorker(double a0)
+{
+	a = a0*RAD;
+	return(Xnewyorker);
+}
diff --git a/src/doug/libmap/orthographic.c b/src/doug/libmap/orthographic.c
new file mode 100644
index 0000000..64e38dd
--- /dev/null
+++ b/src/doug/libmap/orthographic.c
@@ -0,0 +1,40 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+
+int
+Xorthographic(struct place *place, double *x, double *y)
+{
+	*x = - place->nlat.c * place->wlon.s;
+	*y = - place->nlat.c * place->wlon.c;
+	return(place->nlat.l<0.? 0 : 1);
+}
+
+proj
+orthographic(void)
+{
+	return(Xorthographic);
+}
+
+int
+olimb(double *lat, double *lon, double res)
+{
+	static int first  = 1;
+	if(first) {
+		*lat = 0;
+		*lon = -180;
+		first = 0;
+		return 0;
+	}
+	*lon += res;
+	if(*lon <= 180)
+		return 1;
+	first = 1;
+	return -1;
+}
diff --git a/src/doug/libmap/perspective.c b/src/doug/libmap/perspective.c
new file mode 100644
index 0000000..8e13be8
--- /dev/null
+++ b/src/doug/libmap/perspective.c
@@ -0,0 +1,89 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+#define ORTHRAD 1000
+static double viewpt;
+
+static int
+Xperspective(struct place *place, double *x, double *y)
+{
+	double r;
+	if(viewpt<=1+FUZZ && fabs(place->nlat.s)<=viewpt+.01)
+		return(-1);
+	r = place->nlat.c*(viewpt - 1.)/(viewpt - place->nlat.s);
+	*x = - r*place->wlon.s;
+	*y = - r*place->wlon.c;
+	if(r>4.)
+		return(-1);
+	if((fabs(viewpt)>1 && place->nlat.s<1/viewpt) ||
+	   (fabs(viewpt)<=1 && place->nlat.s<viewpt))
+			return 0;
+	return(1);
+}
+
+proj
+perspective(double radius)
+{
+	viewpt = radius;
+	if(viewpt >= ORTHRAD)
+		return(Xorthographic);
+	if(fabs(viewpt-1.)<.0001)
+		return(0);
+	return(Xperspective);
+}
+
+	/* called from various conformal projections,
+           but not from stereographic itself */
+int
+Xstereographic(struct place *place, double *x, double *y)
+{
+	double v = viewpt;
+	int retval;
+	viewpt = -1;
+	retval = Xperspective(place, x, y);
+	viewpt = v;
+	return retval;
+}
+
+proj
+stereographic(void)
+{
+	viewpt = -1.;
+	return(Xperspective);
+}
+
+proj
+gnomonic(void)
+{
+	viewpt = 0.;
+	return(Xperspective);
+}
+
+int
+plimb(double *lat, double *lon, double res)
+{
+	static int first = 1;
+	if(viewpt >= ORTHRAD)
+		return olimb(lat, lon, res);
+	if(first) {
+		first = 0;
+		*lon = -180;
+		if(fabs(viewpt) < .01)
+			*lat = 0;
+		else if(fabs(viewpt)<=1)
+			*lat = asin(viewpt)/RAD;
+		else
+			*lat = asin(1/viewpt)/RAD;
+	} else
+		*lon += res;
+	if(*lon <= 180)
+		return 1;
+	first = 1;
+	return -1;
+}
diff --git a/src/doug/libmap/polyconic.c b/src/doug/libmap/polyconic.c
new file mode 100644
index 0000000..626b5ea
--- /dev/null
+++ b/src/doug/libmap/polyconic.c
@@ -0,0 +1,33 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int
+Xpolyconic(struct place *place, double *x, double *y)
+{
+	double r, alpha;
+	double lat2, lon2;
+	if(fabs(place->nlat.l) > .01) {
+		r = place->nlat.c / place->nlat.s;
+		alpha = place->wlon.l * place->nlat.s;
+		*y = place->nlat.l + r*(1 - cos(alpha));
+		*x = - r*sin(alpha);
+	} else {
+		lon2 = place->wlon.l * place->wlon.l;
+		lat2 = place->nlat.l * place->nlat.l;
+		*y = place->nlat.l * (1+(lon2/2)*(1-(8+lon2)*lat2/12));
+		*x = - place->wlon.l * (1-lat2*(3+lon2)/6);
+	}
+	return(1);
+}
+
+proj
+polyconic(void)
+{
+	return(Xpolyconic);
+}
diff --git a/src/doug/libmap/rectangular.c b/src/doug/libmap/rectangular.c
new file mode 100644
index 0000000..8367956
--- /dev/null
+++ b/src/doug/libmap/rectangular.c
@@ -0,0 +1,27 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double scale;
+
+static int
+Xrectangular(struct place *place, double *x, double *y)
+{
+	*x = -scale*place->wlon.l;
+	*y = place->nlat.l;
+	return(1);
+}
+
+proj
+rectangular(double par)
+{
+	scale = cos(par*RAD);
+	if(scale<.1)
+		return 0;
+	return(Xrectangular);
+}
diff --git a/src/doug/libmap/simpleconic.c b/src/doug/libmap/simpleconic.c
new file mode 100644
index 0000000..46aecb2
--- /dev/null
+++ b/src/doug/libmap/simpleconic.c
@@ -0,0 +1,39 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double r0, a;
+
+static int
+Xsimpleconic(struct place *place, double *x, double *y)
+{
+	double r = r0 - place->nlat.l;
+	double t = a*place->wlon.l;
+	*x = -r*sin(t);
+	*y = -r*cos(t);
+	return 1;
+}
+
+proj
+simpleconic(double par0, double par1)
+{
+	struct coord lat0;
+	struct coord lat1;
+	deg2rad(par0,&lat0);
+	deg2rad(par1,&lat1);
+	if(fabs(lat0.l+lat1.l)<.01)
+		return rectangular(par0);
+	if(fabs(lat0.l-lat1.l)<.01) {
+		a = lat0.s/lat0.l;
+		r0 = lat0.c/lat0.s + lat0.l;
+	} else {
+		a = (lat1.c-lat0.c)/(lat0.l-lat1.l);
+		r0 = ((lat0.c+lat1.c)/a + lat1.l + lat0.l)/2;
+	}
+	return Xsimpleconic;
+}
diff --git a/src/doug/libmap/sinusoidal.c b/src/doug/libmap/sinusoidal.c
new file mode 100644
index 0000000..5b67c3e
--- /dev/null
+++ b/src/doug/libmap/sinusoidal.c
@@ -0,0 +1,22 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+int
+Xsinusoidal(struct place *place, double *x, double *y)
+{
+	*x = - place->wlon.l * place->nlat.c;
+	*y = place->nlat.l;
+	return(1);
+}
+
+proj
+sinusoidal(void)
+{
+	return(Xsinusoidal);
+}
diff --git a/src/doug/libmap/tetra.c b/src/doug/libmap/tetra.c
new file mode 100644
index 0000000..e93f6de
--- /dev/null
+++ b/src/doug/libmap/tetra.c
@@ -0,0 +1,214 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+/*
+ *	conformal map of earth onto tetrahedron
+ *	the stages of mapping are
+ *	(a) stereo projection of tetrahedral face onto
+ *	    isosceles curvilinear triangle with 3 120-degree
+ *	    angles and one straight side
+ *	(b) map of this triangle onto half plane cut along
+ *	    3 rays from the roots of unity to infinity
+ *		formula (z^4+2*3^.5*z^2-1)/(z^4-2*3^.5*z^2-1)
+ *	(c) do 3 times for  each sector of plane:
+ *	    map of |arg z|<=pi/6, cut along z>1 into
+ *	    triangle |arg z|<=pi/6, Re z<=const,
+ *	    with upper side of cut going into upper half of
+ *	    of vertical side of triangle and lowere into lower
+ *		formula int from 0 to z dz/sqrt(1-z^3)
+ *
+ *	int from u to 1 3^.25*du/sqrt(1-u^3) =
+		F(acos((rt3-1+u)/(rt3+1-u)),sqrt(1/2+rt3/4))
+ *	int from 1 to u 3^.25*du/sqrt(u^3-1) =
+ *		F(acos((rt3+1-u)/(rt3-1+u)),sqrt(1/2-rt3/4))
+ *	this latter formula extends analytically down to
+ *	u=0 and is the basis of this routine, with the
+ *	argument of complex elliptic integral elco2
+ *	being tan(acos...)
+ *	the formula F(pi-x,k) = 2*F(pi/2,k)-F(x,k) is
+ *	used to cross over into the region where Re(acos...)>pi/2
+ *		f0 and fpi are suitably scaled complete integrals
+*/
+
+#define TFUZZ 0.00001
+
+static struct place tpole[4];	/* point of tangency of tetrahedron face*/
+static double tpoleinit[4][2] = {
+	{ 1.,	0. },
+	{ 1.,	180. },
+	{ -1.,	90. },
+	{ -1.,	-90 }
+};
+static struct tproj {
+	double tlat,tlon;	/* center of stereo projection*/
+	double ttwist;		/* rotatn before stereo*/
+	double trot;		/*rotate after projection*/
+	struct place projpl;	/*same as tlat,tlon*/
+	struct coord projtw;	/*same as ttwist*/
+	struct coord postrot;	/*same as trot*/
+} tproj[4][4] = {
+{/*00*/	{0.},
+ /*01*/	{90.,	0.,	90.,	-90.},
+ /*02*/	{0.,	45.,	-45.,	150.},
+ /*03*/	{0.,	-45.,	-135.,	30.}
+},
+{/*10*/	{90.,	0.,	-90.,	90.},
+ /*11*/ {0.},
+ /*12*/ {0.,	135.,	-135.,	-150.},
+ /*13*/	{0.,	-135.,	-45.,	-30.}
+},
+{/*20*/	{0.,	45.,	135.,	-30.},
+ /*21*/	{0.,	135.,	45.,	-150.},
+ /*22*/	{0.},
+ /*23*/	{-90.,	0.,	180.,	90.}
+},
+{/*30*/	{0.,	-45.,	45.,	-150.},
+ /*31*/ {0.,	-135.,	135.,	-30.},
+ /*32*/	{-90.,	0.,	0.,	90.},
+ /*33*/ {0.} 
+}};
+
+static double tx0[4] = {	/*where to move facet after final rotation*/
+	0.,	0.,	-1.,	1.	/*-1,1 to be sqrt(3)*/
+};
+static double ty0[4] = {
+	0.,	2.,	-1.,	-1.
+};
+static double tx[4];
+static double ty[4];
+static double root3;
+static double rt3inv;
+static double two_rt3;
+static double tkc,tk,tcon;
+static double f0r,f0i,fpir,fpii;
+
+static void
+twhichp(struct place *g, int *p, int *q)
+{
+	int i,j,k;
+	double cosdist[4];
+	struct place *tp;
+	for(i=0;i<4;i++) {
+		tp = &tpole[i];
+		cosdist[i] = g->nlat.s*tp->nlat.s +
+			  g->nlat.c*tp->nlat.c*(
+			  g->wlon.s*tp->wlon.s +
+			  g->wlon.c*tp->wlon.c);
+	}
+	j = 0;
+	for(i=1;i<4;i++)
+		if(cosdist[i] > cosdist[j])
+			j = i;
+	*p = j;
+	k = j==0?1:0;
+	for(i=0;i<4;i++)
+		if(i!=j&&cosdist[i]>cosdist[k])
+			k = i;
+	*q = k;
+}
+
+int
+Xtetra(struct place *place, double *x, double *y)
+{
+	int i,j;
+	struct place pl;
+	register struct tproj *tpp;
+	double vr, vi;
+	double br, bi;
+	double zr,zi,z2r,z2i,z4r,z4i,sr,si,tr,ti;
+	twhichp(place,&i,&j);
+	copyplace(place,&pl);
+	norm(&pl,&tproj[i][j].projpl,&tproj[i][j].projtw);
+	Xstereographic(&pl,&vr,&vi);
+	zr = vr/2;
+	zi = vi/2;
+	if(zr<=TFUZZ)
+		zr = TFUZZ;
+	csq(zr,zi,&z2r,&z2i);
+	csq(z2r,z2i,&z4r,&z4i);
+	z2r *= two_rt3;
+	z2i *= two_rt3;
+	cdiv(z4r+z2r-1,z4i+z2i,z4r-z2r-1,z4i-z2i,&sr,&si);
+	csqrt(sr-1,si,&tr,&ti);
+	cdiv(tcon*tr,tcon*ti,root3+1-sr,-si,&br,&bi);
+	if(br<0) {
+		br = -br;
+		bi = -bi;
+		if(!elco2(br,bi,tk,1.,1.,&vr,&vi))
+			return 0;
+		vr = fpir - vr;
+		vi = fpii - vi;
+	} else 
+		if(!elco2(br,bi,tk,1.,1.,&vr,&vi))
+			return 0;
+	if(si>=0) {
+		tr = f0r - vi;
+		ti = f0i + vr;
+	} else {
+		tr = f0r + vi;
+		ti = f0i - vr;
+	}
+	tpp = &tproj[i][j];
+	*x = tr*tpp->postrot.c +
+	     ti*tpp->postrot.s + tx[i];
+	*y = ti*tpp->postrot.c -
+	     tr*tpp->postrot.s + ty[i];
+	return(1);
+}
+
+int
+tetracut(struct place *g, struct place *og, double *cutlon)
+{
+	int i,j,k;
+	if((g->nlat.s<=-rt3inv&&og->nlat.s<=-rt3inv) && 
+	   (ckcut(g,og,*cutlon=0.)==2||ckcut(g,og,*cutlon=PI)==2))
+		return(2);
+	twhichp(g,&i,&k);
+	twhichp(og,&j,&k);
+	if(i==j||i==0||j==0)
+		return(1);
+	return(0);
+}
+
+proj
+tetra(void)
+{
+	int i;
+	int j;
+	register struct place *tp;
+	register struct tproj *tpp;
+	double t;
+	root3 = sqrt(3.);
+	rt3inv = 1/root3;
+	two_rt3 = 2*root3;
+	tkc = sqrt(.5-.25*root3);
+	tk = sqrt(.5+.25*root3);
+	tcon = 2*sqrt(root3);
+	elco2(tcon/(root3-1),0.,tkc,1.,1.,&f0r,&f0i);
+	elco2(1.e15,0.,tk,1.,1.,&fpir,&fpii);
+	fpir *= 2;
+	fpii *= 2;
+	for(i=0;i<4;i++) {
+		tx[i] = tx0[i]*f0r*root3;
+		ty[i] = ty0[i]*f0r;
+		tp = &tpole[i];
+		t = tp->nlat.s = tpoleinit[i][0]/root3;
+		tp->nlat.c = sqrt(1 - t*t);
+		tp->nlat.l = atan2(tp->nlat.s,tp->nlat.c);
+		deg2rad(tpoleinit[i][1],&tp->wlon);
+		for(j=0;j<4;j++) {
+			tpp = &tproj[i][j];
+			latlon(tpp->tlat,tpp->tlon,&tpp->projpl);
+			deg2rad(tpp->ttwist,&tpp->projtw);
+			deg2rad(tpp->trot,&tpp->postrot);
+		}
+	}
+	return(Xtetra);
+}
+
diff --git a/src/doug/libmap/trapezoidal.c b/src/doug/libmap/trapezoidal.c
new file mode 100644
index 0000000..e3d4693
--- /dev/null
+++ b/src/doug/libmap/trapezoidal.c
@@ -0,0 +1,35 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static struct coord stdpar0, stdpar1;
+static double k;
+static double yeq;
+
+static int
+Xtrapezoidal(struct place *place, double *x, double *y)
+{
+	*y = yeq + place->nlat.l;
+	*x = *y*k*place->wlon.l;
+	return 1;
+}
+
+proj
+trapezoidal(double par0, double par1)
+{
+	if(fabs(fabs(par0)-fabs(par1))<.1)
+		return rectangular(par0);
+	deg2rad(par0,&stdpar0);
+	deg2rad(par1,&stdpar1);
+	if(fabs(par1-par0) < .1)
+		k = stdpar1.s;
+	else
+		k = (stdpar1.c-stdpar0.c)/(stdpar0.l-stdpar1.l);
+	yeq = -stdpar1.l - stdpar1.c/k;
+	return Xtrapezoidal;
+}
diff --git a/src/doug/libmap/twocirc.c b/src/doug/libmap/twocirc.c
new file mode 100644
index 0000000..733cc17
--- /dev/null
+++ b/src/doug/libmap/twocirc.c
@@ -0,0 +1,85 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double
+quadratic(double a, double b, double c)
+{
+	double disc = b*b - 4*a*c;
+	return disc<0? 0: (-b-sqrt(disc))/(2*a);
+}
+
+/* for projections with meridians being circles centered
+on the x axis and parallels being circles centered on the y
+axis.  Find the intersection of the meridian thru (m,0), (90,0),
+with the parallel thru (0,p), (p1,p2) */
+
+static int
+twocircles(double m, double p, double p1, double p2, double *x, double *y)
+{
+	double a;	/* center of meridian circle, a>0 */
+	double b;	/* center of parallel circle, b>0 */
+	double t,bb;
+	if(m > 0) {
+		twocircles(-m,p,p1,p2,x,y);
+		*x = -*x;
+	} else if(p < 0) {
+		twocircles(m,-p,p1,-p2,x,y);
+		*y = -*y;
+	} else if(p < .01) {
+		*x = m;
+		t = m/p1;
+		*y = p + (p2-p)*t*t;
+	} else if(m > -.01) {
+		*y = p;
+		*x = m - m*p*p;
+	} else {
+		b = p>=1? 1: p>.99? 0.5*(p+1 + p1*p1/(1-p)):
+			0.5*(p*p-p1*p1-p2*p2)/(p-p2);
+		a = .5*(m - 1/m);
+		t = m*m-p*p+2*(b*p-a*m);
+		bb = b*b;
+		*x = quadratic(1+a*a/bb, -2*a + a*t/bb,
+			t*t/(4*bb) - m*m + 2*a*m);
+		*y = (*x*a+t/2)/b;
+	}
+	return 1;
+}		
+
+static int
+Xglobular(struct place *place, double *x, double *y)
+{
+	twocircles(-2*place->wlon.l/PI,
+		2*place->nlat.l/PI, place->nlat.c, place->nlat.s, x, y);
+	return 1;
+}	
+
+proj
+globular(void)
+{
+	return Xglobular;
+}
+
+static int
+Xvandergrinten(struct place *place, double *x, double *y)
+{
+	double t = 2*place->nlat.l/PI;
+	double abst = fabs(t);
+	double pval = abst>=1? 1: abst/(1+sqrt(1-t*t));
+	double p2 = 2*pval/(1+pval);
+	twocircles(-place->wlon.l/PI, pval, sqrt(1-p2*p2), p2, x, y);
+	if(t < 0) 
+		*y = -*y;
+	return 1;
+}
+
+proj
+vandergrinten(void)
+{
+	return Xvandergrinten;
+}
diff --git a/src/doug/libmap/zcoord.c b/src/doug/libmap/zcoord.c
new file mode 100644
index 0000000..a124f0c
--- /dev/null
+++ b/src/doug/libmap/zcoord.c
@@ -0,0 +1,149 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+static double cirmod(double);
+
+static struct place pole;	/* map pole is tilted to here */
+static struct coord twist;	/* then twisted this much */
+static struct place ipole;	/* inverse transfrom */
+static struct coord itwist;
+
+void
+orient(double lat, double lon, double theta)
+{
+	lat = cirmod(lat);
+	if(lat>90.) {
+		lat = 180. - lat;
+		lon -= 180.;
+		theta -= 180.;
+	} else if(lat < -90.) {
+		lat = -180. - lat;
+		lon -= 180.;
+		theta -= 180;
+	}
+	latlon(lat,lon,&pole);
+	deg2rad(theta, &twist);
+	latlon(lat,180.-theta,&ipole);
+	deg2rad(180.-lon, &itwist);
+}
+
+void
+latlon(double lat, double lon, struct place *p)
+{
+	lat = cirmod(lat);
+	if(lat>90.) {
+		lat = 180. - lat;
+		lon -= 180.;
+	} else if(lat < -90.) {
+		lat = -180. - lat;
+		lon -= 180.;
+	}
+	deg2rad(lat,&p->nlat);
+	deg2rad(lon,&p->wlon);
+}
+
+void
+deg2rad(double theta, struct coord *coord)
+{
+	theta = cirmod(theta);
+	coord->l = theta*RAD;
+	if(theta==90) {
+		coord->s = 1;
+		coord->c = 0;
+	} else if(theta== -90) {
+		coord->s = -1;
+		coord->c = 0;
+	} else
+		trig(coord);
+}
+
+static double
+cirmod(double theta)
+{
+	while(theta >= 180.)
+		theta -= 360;
+	while(theta<-180.)
+		theta += 360.;
+	return(theta);
+}
+
+double
+trigclamp(double x)
+{
+	return x>1? 1: x<-1? -1: x;
+}
+
+void
+trig(struct coord *coord)
+{
+	coord->s = sin(coord->l);
+	coord->c = cos(coord->l);
+}
+
+void
+normalize(struct place *gg)
+{
+	norm(gg,&pole,&twist);
+}
+
+void
+invert(struct place *g)
+{
+	norm(g,&ipole,&itwist);
+}
+
+void
+norm(struct place *gg, struct place *pp, struct coord *tw)
+{
+	register struct place *g;	/*geographic coords */
+	register struct place *p;	/* new pole in old coords*/
+	struct place m;			/* standard map coords*/
+	g = gg;
+	p = pp;
+	if(p->nlat.s == 1.) {
+		if(p->wlon.l+tw->l == 0.)
+			return;
+		g->wlon.l -= p->wlon.l+tw->l;
+	} else {
+		if(p->wlon.l != 0) {
+			g->wlon.l -= p->wlon.l;
+			trig(&g->wlon);
+		}
+		m.nlat.s = trigclamp(
+			p->nlat.s * g->nlat.s
+			+ p->nlat.c * g->nlat.c * g->wlon.c);
+		m.nlat.c = sqrt(1. - m.nlat.s * m.nlat.s);
+		m.nlat.l = atan2(m.nlat.s, m.nlat.c);
+		m.wlon.s = g->nlat.c * g->wlon.s;
+		m.wlon.c = trigclamp(
+			p->nlat.c * g->nlat.s
+			- p->nlat.s * g->nlat.c * g->wlon.c);
+		m.wlon.l = atan2(m.wlon.s, - m.wlon.c)
+			- tw->l;
+		*g = m;
+	}
+	trig(&g->wlon);
+	if(g->wlon.l>PI)
+		g->wlon.l -= 2*PI;
+	else if(g->wlon.l<-PI)
+		g->wlon.l += 2*PI;
+}
+
+void
+printp(struct place *g)
+{
+printf("%.3f %.3f %.3f %.3f %.3f %.3f\n",
+g->nlat.l,g->nlat.s,g->nlat.c,g->wlon.l,g->wlon.s,g->wlon.c);
+}
+
+void
+copyplace(struct place *g1, struct place *g2)
+{
+	*g2 = *g1;
+}
diff --git a/src/doug/map.c b/src/doug/map.c
new file mode 100644
index 0000000..341cd81
--- /dev/null
+++ b/src/doug/map.c
@@ -0,0 +1,1265 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+#include "plot.h"
+
+#define NVERT 20	/* max number of vertices in a -b polygon */
+#define HALFWIDTH 8192	/* output scaled to fit in -HALFWIDTH,HALFWIDTH */
+#define LONGLINES (HALFWIDTH*4)	/* permissible segment lengths */
+#define SHORTLINES (HALFWIDTH/8)
+#define SCALERATIO 10	/* of abs to rel data (see map(5)) */
+#define RESOL 2.	/* coarsest resolution for tracing grid (degrees) */
+#define TWO_THRD 0.66666666666666667
+
+int normproj(double, double, double *, double *);
+int posproj(double, double, double *, double *);
+int picut(struct place *, struct place *, double *);
+double reduce(double);
+short getshort(FILE *);
+char *mapindex(char *);
+proj projection;
+
+#ifndef MAPDIR
+#define MAPDIR "/usr/lib/map/lib"
+#endif
+
+static char *version = "map version 2004.03.30";
+
+static char *mapdir = MAPDIR; /* default map directory */
+struct file {
+	char *name;
+	char *color;
+	char *style;
+	double weight;
+};
+static struct file dfltfile = {
+	"world", BLACK, SOLID	/* default map */
+};
+static struct file *file = &dfltfile;	/* list of map files */
+static int nfile = 1;			/* length of list */
+static char *currcolor = BLACK;		/* current color */
+static char *gridcolor = BLACK;
+static char *bordcolor = BLACK;
+
+static double currweight = 0;		/* line weight, use default */
+static double gridweight = 0;
+static double bordweight = 0;
+
+static char *currstyle = SOLID;		/* line style */
+static char *gridstyle = DOTTED;
+static char *bordstyle = SOLID;
+
+extern struct pindex pindex[];
+int halfwidth = HALFWIDTH;
+
+static int (*cut)(struct place *, struct place *, double *);
+static int (*limb)(double*, double*, double);
+static void dolimb(void);
+static int onlimb;
+static int poles;
+static double orientation[3] = { 90., 0., 0. };	/* -o option */
+static int oriented;	/* nonzero if -o option occurred */
+static int upright;		/* 1 if orientation[0]==90, -1 if -90, else 0*/
+static int delta = 1;	/* -d setting */
+static double limits[4] = {	/* -l parameters */
+	-90., 90., -180., 180.
+};
+static double klimits[4] = {	/* -k parameters */
+	-90., 90., -180., 180.
+};
+static int limcase;
+static double rlimits[4];	/* limits expressed in radians */
+static double lolat, hilat, lolon, hilon;
+static double window[4] = {	/* option -w */
+	-90., 90., -180., 180.
+};
+static int windowed;	/* nozero if option -w */
+static struct vert { double x, y; } v[NVERT+2];	/*clipping polygon*/
+static struct edge { double a, b, c; } e[NVERT]; /* coeffs for linear inequality */
+static int nvert;	/* number of vertices in clipping polygon */
+
+static double rwindow[4];	/* window, expressed in radians */
+static double params[2];		/* projection params */
+/* bounds on output values before scaling; found by coarse survey */
+static double xmin = 100.;
+static double xmax = -100.;
+static double ymin = 100.;
+static double ymax = -100.;
+static double xcent, ycent;
+static double xoff, yoff;
+double xrange, yrange;
+static int left = -HALFWIDTH;
+static int right = HALFWIDTH;
+static int bottom = -HALFWIDTH;
+static int top = HALFWIDTH;
+static int longlines = SHORTLINES; /* drop longer segments */
+static int shortlines = SHORTLINES;
+static int bflag = 1;	/* 0 for option -b */
+static int s1flag = 0;	/* 1 for option -s1 */
+static int s2flag = 0;	/* 1 for option -s2 */
+static int rflag = 0;	/* 1 for option -r */
+static int kflag = 0;	/* 1 if option -k occurred */
+static int xflag = 0;	/* 1 for option -x */
+static int sflag = 0;	/* 1 for option -L */
+       int vflag = 1;	/* -1 if option -v occurred */
+static double position[3];	/* option -p */
+static double center[3] = {0., 0., 0.};	/* option -c */
+static struct coord crot;		/* option -c */
+static double grid[3] = { 10., 10., RESOL };	/* option -g */
+static double dlat, dlon;	/* resolution for tracing grid in lat and lon */
+static double scaling;	/* to compute final integer output */
+static struct file *track;	/* options -t and -u */
+static int ntrack;		/* number of tracks present */
+static char *symbolfile;	/* option -y */
+
+void	clamp(double *px, double v);
+void	clipinit(void);
+double	diddle(struct place *, double, double);
+double	diddle(struct place *, double, double);
+void	dobounds(double, double, double, double, int);
+void	dogrid(double, double, double, double);
+int	duple(struct place *, double);
+double	fmax(double, double);
+double	fmin(double, double);
+void	getdata(char *);
+int	gridpt(double, double, int);
+int	inpoly(double, double);
+int	inwindow(struct place *);
+void	pathnames(void);
+int	pnorm(double);
+void	radbds(double *w, double *rw);
+void	revlon(struct place *, double);
+void	satellite(struct file *);
+int	seeable(double, double);
+void	windlim(void);
+void	realcut(void);
+
+int
+option(char *s) 
+{
+
+	if(s[0]=='-' && (s[1]<'0'||s[1]>'9'))
+		return(s[1]!='.'&&s[1]!=0);
+	else
+		return(0);
+}
+
+void
+conv(int k, struct coord *g)
+{
+	g->l = (0.0001/SCALERATIO)*k;
+	trig(g);
+}
+
+int
+main(int argc, char *argv[])
+{
+	int i,k;
+	char *s, *t, *style;
+	double x, y;
+	double lat, lon;
+	double *wlim;
+	double dd;
+	if(sizeof(short)!=2)
+		abort();	/* getshort() won't work */
+	s = getenv("MAP");
+	if(s)
+		file[0].name = s;
+	s = getenv("MAPDIR");
+	if(s)
+		mapdir = s;
+	if(argc<=1) 
+		error("usage: map projection params options");
+	for(k=0;pindex[k].name;k++) {
+		s = pindex[k].name;
+		t = argv[1];
+		while(*s == *t){
+			if(*s==0) goto found;
+			s++;
+			t++;
+		}
+	}
+	fprintf(stderr,"%s projections:\n",version);
+	for(i=0;pindex[i].name;i++)  {
+		fprintf(stderr,"%s",pindex[i].name);
+		for(k=0; k<pindex[i].npar; k++)
+			fprintf(stderr," p%d", k);
+		fprintf(stderr,"\n");
+	}
+	exit(1);
+found:
+	argv += 2;
+	argc -= 2;
+	cut = pindex[k].cut;
+	limb = pindex[k].limb;
+	poles = pindex[k].poles;
+	for(i=0;i<pindex[k].npar;i++) {
+		if(i>=argc||option(argv[i])) {
+			fprintf(stderr,"%s needs %d params\n",pindex[k].name,pindex[k].npar);
+			exit(1);
+		}
+		params[i] = atof(argv[i]);
+	}
+	argv += i;
+	argc -= i;
+	while(argc>0&&option(argv[0])) {
+		argc--;
+		argv++;
+		switch(argv[-1][1]) {
+		case 'm':
+			if(file == &dfltfile) {
+				file = 0;
+				nfile = 0;
+			}
+			while(argc && !option(*argv)) {
+				file = realloc(file,(nfile+1)*sizeof(*file));
+				file[nfile].name = *argv;
+				file[nfile].color = currcolor;
+				file[nfile].style = SOLID;
+				file[nfile].weight = currweight;
+				nfile++;
+				argv++;
+				argc--;
+			}
+			break;
+		case 'b':
+			bflag = 0;
+			bordweight = currweight;
+			bordstyle = currstyle;
+			for(nvert=0;argc>1&&nvert<NVERT;nvert++) {
+				if(option(*argv))
+					break;
+				v[nvert].x = atof(*argv++);
+				argc--;
+				if(option(*argv))
+					error("bad clipping vertex");
+				v[nvert].y = atof(*argv++);
+				argc--;
+			}
+			if(nvert>=NVERT)
+				error("too many clipping vertices");
+			break;
+		case 'g':
+			gridcolor = currcolor;
+			if(sflag)
+				gridstyle = currstyle;
+			gridweight = currweight;
+			for(i=0;i<3&&argc>i&&!option(argv[i]);i++)
+				grid[i] = atof(argv[i]);
+			switch(i) {
+			case 0:
+				grid[0] = grid[1] = 0.;
+				break;
+			case 1:
+				grid[1] = grid[0];
+			}
+			argc -= i;
+			argv += i;
+			break;
+		case 't':
+			style = DOTDASH;
+			goto casetu;
+		case 'u':
+			style = SOLID;
+		casetu: 
+			if(sflag)
+				style = currstyle;
+			while(argc && !option(*argv)) {
+				track = realloc(track,(ntrack+1)*sizeof(*track));
+				track[ntrack].name = *argv;
+				track[ntrack].color = currcolor;
+				track[ntrack].style = style;
+				track[ntrack].weight = currweight;
+				ntrack++;
+				argv++;
+				argc--;
+			}
+			break;
+		case 'r':
+			rflag++;
+			break;
+		case 's':
+			switch(argv[-1][2]) {
+			case '1':
+				s1flag++;
+				break;
+			case 0:		/* compatibility */
+			case '2':
+				s2flag++;
+			}
+			break;
+		case 'o':
+			for(i=0;i<3&&i<argc&&!option(argv[i]);i++)
+				orientation[i] = atof(argv[i]);
+			oriented++;
+			argv += i;
+			argc -= i;
+			break;
+		case 'l':
+			for(i=0;i<argc&&i<4&&!option(argv[i]);i++)
+				limits[i] = atof(argv[i]);
+			argv += i;
+			argc -= i;
+			break;
+		case 'k':
+			kflag++;
+			for(i=0;i<argc&&i<4&&!option(argv[i]);i++)
+				klimits[i] = atof(argv[i]);
+			argv += i;
+			argc -= i;
+			break;
+		case 'd':
+			if(argc>0&&!option(argv[0])) {
+				delta = atoi(argv[0]);
+				argv++;
+				argc--;
+			}
+			break;
+		case 'w':
+			windowed++;
+			for(i=0;i<argc&&i<4&&!option(argv[i]);i++)
+				window[i] = atof(argv[i]);
+			argv += i;
+			argc -= i;
+			break;
+		case 'c':
+			for(i=0;i<3&&argc>i&&!option(argv[i]);i++) 
+				center[i] = atof(argv[i]);
+			argc -= i;
+			argv += i;
+			break;
+		case 'p':
+			for(i=0;i<3&&argc>i&&!option(argv[i]);i++)
+				position[i] = atof(argv[i]);
+			argc -= i;
+			argv += i;
+			if(i!=3||position[2]<=0) 
+				error("incomplete positioning");
+			break;
+		case 'y':
+			if(argc>0&&!option(argv[0])) {
+				symbolfile = argv[0];
+				argc--;
+				argv++;
+			}
+			break;
+		case 'v':
+			if(pindex[k].limb == 0)
+				error("-v does not apply here");
+			vflag = -1;
+			break;
+		case 'x':
+			xflag = 1;
+			break;
+		case 'C':
+			if(argc && !option(*argv)) {
+				currcolor = *argv;
+				argc--;
+				argv++;
+			}
+			break;
+		case 'L':
+			if(argc && !option(*argv)) {
+				currstyle = *argv;
+				sflag++;
+				argc--;
+				argv++;
+			}
+			break;
+		case 'W':
+			if(argc && !option(*argv)) {
+				currweight = atof(*argv);
+				argc--;
+				argv++;
+			}
+			break;
+		}
+	}
+	if(argc>0)
+		error("error in arguments");
+	pathnames();
+	clamp(&limits[0],-90.);
+	clamp(&limits[1],90.);
+	clamp(&klimits[0],-90.);
+	clamp(&klimits[1],90.);
+	clamp(&window[0],-90.);
+	clamp(&window[1],90.);
+	radbds(limits,rlimits);
+	limcase = limits[2]<-180.?0:
+		  limits[3]>180.?2:
+		  1;
+	if(
+		window[0]>=window[1]||
+		window[2]>=window[3]||
+		window[0]>90.||
+		window[1]<-90.||
+		window[2]>180.||
+		window[3]<-180.)
+		error("unreasonable window");
+	windlim();
+	radbds(window,rwindow);
+	upright = orientation[0]==90? 1: orientation[0]==-90? -1: 0;
+	if(pindex[k].spheroid && !upright)
+		error("can't tilt the spheroid");
+	if(limits[2]>limits[3])
+		limits[3] += 360;
+	if(!oriented)
+		orientation[2] = (limits[2]+limits[3])/2;
+	orient(orientation[0],orientation[1],orientation[2]);
+	projection = (*pindex[k].prog)(params[0],params[1]);
+	if(projection == 0)
+		error("unreasonable projection parameters");
+	clipinit();
+	grid[0] = fabs(grid[0]);
+	grid[1] = fabs(grid[1]);
+	if(!kflag)
+		for(i=0;i<4;i++)
+			klimits[i] = limits[i];
+	if(klimits[2]>klimits[3])
+		klimits[3] += 360;
+	lolat = limits[0];
+	hilat = limits[1];
+	lolon = limits[2];
+	hilon = limits[3];
+	if(lolon>=hilon||lolat>=hilat||lolat<-90.||hilat>90.)
+		error("unreasonable limits");
+	wlim = kflag? klimits: window;
+	dlat = fmin(hilat-lolat,wlim[1]-wlim[0])/16;
+	dlon = fmin(hilon-lolon,wlim[3]-wlim[2])/32;
+	dd = fmax(dlat,dlon);
+	while(grid[2]>fmin(dlat,dlon)/2)
+		grid[2] /= 2;
+	realcut();
+	if(nvert<=0) {
+		for(lat=klimits[0];lat<klimits[1]+dd-FUZZ;lat+=dd) {
+			if(lat>klimits[1])
+				lat = klimits[1];
+			for(lon=klimits[2];lon<klimits[3]+dd-FUZZ;lon+=dd) {
+				i = (kflag?posproj:normproj)
+					(lat,lon+(lon<klimits[3]?FUZZ:-FUZZ),
+				   &x,&y);
+				if(i*vflag <= 0)
+					continue;
+				if(x<xmin) xmin = x;
+				if(x>xmax) xmax = x;
+				if(y<ymin) ymin = y;
+				if(y>ymax) ymax = y;
+			}
+		}
+	} else {
+		for(i=0; i<nvert; i++) {
+			x = v[i].x;
+			y = v[i].y;
+			if(x<xmin) xmin = x;
+			if(x>xmax) xmax = x;
+			if(y<ymin) ymin = y;
+			if(y>ymax) ymax = y;
+		}
+	}
+	xrange = xmax - xmin;
+	yrange = ymax - ymin;
+	if(xrange<=0||yrange<=0)
+		error("map seems to be empty");
+	scaling = 2;	/*plotting area from -1 to 1*/
+	if(position[2]!=0) {
+		if(posproj(position[0]-.5,position[1],&xcent,&ycent)==0||
+		   posproj(position[0]+.5,position[1],&x,&y)==0)
+			error("unreasonable position");
+		scaling /= (position[2]*hypot(x-xcent,y-ycent));
+		if(posproj(position[0],position[1],&xcent,&ycent)==0)
+			error("unreasonable position");
+	} else {
+		scaling /= (xrange>yrange?xrange:yrange);
+		xcent = (xmin+xmax)/2;
+		ycent = (ymin+ymax)/2;
+	}
+	xoff = center[0]/scaling;
+	yoff = center[1]/scaling;
+	crot.l = center[2]*RAD;
+	trig(&crot);
+	scaling *= HALFWIDTH*0.9;
+	if(symbolfile) 
+		getsyms(symbolfile);
+	if(!s2flag) {
+		openpl();
+		erase();
+	}
+	range(left,bottom,right,top);
+	comment("grid","");
+	color(gridcolor);
+	weight(gridweight);
+	pen(gridstyle);
+	if(grid[0]>0.)
+		for(lat=ceil(lolat/grid[0])*grid[0];
+		    lat<=hilat;lat+=grid[0]) 
+			dogrid(lat,lat,lolon,hilon);
+	if(grid[1]>0.)
+		for(lon=ceil(lolon/grid[1])*grid[1];
+		    lon<=hilon;lon+=grid[1]) 
+			dogrid(lolat,hilat,lon,lon);
+	comment("border","");
+	color(bordcolor);
+	weight(bordweight);
+	pen(bordstyle);
+	if(bflag) {
+		dolimb();
+		dobounds(lolat,hilat,lolon,hilon,0);
+		dobounds(window[0],window[1],window[2],window[3],1);
+	}
+	lolat = floor(limits[0]/10)*10;
+	hilat = ceil(limits[1]/10)*10;
+	lolon = floor(limits[2]/10)*10;
+	hilon = ceil(limits[3]/10)*10;
+	if(lolon>hilon)
+		hilon += 360.;
+	/*do tracks first so as not to lose the standard input*/
+	for(i=0;i<ntrack;i++) {
+		longlines = LONGLINES;
+		satellite(&track[i]);
+		longlines = shortlines;
+	}
+	for(i=0;i<nfile;i++) {
+		comment("mapfile",file[i].name);
+		color(file[i].color);
+		weight(file[i].weight);
+		pen(file[i].style);
+		getdata(file[i].name);
+	}
+	move(right,bottom);
+	if(!s1flag)
+		closepl();
+	return 0;
+}
+
+/* Out of perverseness (really to recover from a dubious,
+   but documented, convention) the returns from projection
+   functions (-1 unplottable, 0 wrong sheet, 1 good) are
+   recoded into -1 wrong sheet, 0 unplottable, 1 good. */
+
+int
+fixproj(struct place *g, double *x, double *y)
+{
+	int i = (*projection)(g,x,y);
+	return i<0? 0: i==0? -1: 1;
+}
+
+int
+normproj(double lat, double lon, double *x, double *y)
+{
+	int i;
+	struct place geog;
+	latlon(lat,lon,&geog);
+/*
+	printp(&geog);
+*/
+	normalize(&geog);
+	if(!inwindow(&geog))
+		return(-1);
+	i = fixproj(&geog,x,y);
+	if(rflag) 
+		*x = -*x;
+/*
+	printp(&geog);
+	fprintf(stderr,"%d %.3f %.3f\n",i,*x,*y);
+*/
+	return(i);
+}
+
+int
+posproj(double lat, double lon, double *x, double *y)
+{
+	int i;
+	struct place geog;
+	latlon(lat,lon,&geog);
+	normalize(&geog);
+	i = fixproj(&geog,x,y);
+	if(rflag) 
+		*x = -*x;
+	return(i);
+}
+
+int
+inwindow(struct place *geog)
+{
+	if(geog->nlat.l<rwindow[0]-FUZZ||
+	   geog->nlat.l>rwindow[1]+FUZZ||
+	   geog->wlon.l<rwindow[2]-FUZZ||
+	   geog->wlon.l>rwindow[3]+FUZZ)
+		return(0);
+	else return(1);
+}
+
+int
+inlimits(struct place *g)
+{
+	if(rlimits[0]-FUZZ>g->nlat.l||
+	   rlimits[1]+FUZZ<g->nlat.l)
+		return(0);
+	switch(limcase) {
+	case 0:
+		if(rlimits[2]+TWOPI-FUZZ>g->wlon.l&&
+		   rlimits[3]+FUZZ<g->wlon.l)
+			return(0);
+		break;
+	case 1:
+		if(rlimits[2]-FUZZ>g->wlon.l||
+		   rlimits[3]+FUZZ<g->wlon.l)
+			return(0);
+		break;
+	case 2:
+		if(rlimits[2]>g->wlon.l&&
+		   rlimits[3]-TWOPI+FUZZ<g->wlon.l)
+			return(0);
+		break;
+	}
+	return(1);
+}
+
+
+long patch[18][36];
+
+void
+getdata(char *mapfile)
+{
+	char *indexfile;
+	int kx,ky,c;
+	int k;
+	long b;
+	long *p;
+	int ip, jp;
+	int n;
+	struct place g;
+	int i, j;
+	double lat, lon;
+	int conn;
+	FILE *ifile, *xfile;
+
+	indexfile = mapindex(mapfile);
+	xfile = fopen(indexfile,"r");
+	if(xfile==NULL)
+		filerror("can't find map index", indexfile);
+	free(indexfile);
+	for(i=0,p=patch[0];i<18*36;i++,p++)
+		*p = 1;
+	while(!feof(xfile) && fscanf(xfile,"%d%d%ld",&i,&j,&b)==3)
+		patch[i+9][j+18] = b;
+	fclose(xfile);
+	ifile = fopen(mapfile,"rb");
+	if(ifile==NULL)
+		filerror("can't find map data", mapfile);
+	for(lat=lolat;lat<hilat;lat+=10.)
+		for(lon=lolon;lon<hilon;lon+=10.) {
+			if(!seeable(lat,lon))
+				continue;
+			i = pnorm(lat);
+			j = pnorm(lon);
+			if((b=patch[i+9][j+18])&1)
+				continue;
+			fseek(ifile,b,0);
+			while((ip=getc(ifile))>=0&&(jp=getc(ifile))>=0){
+				if(ip!=(i&0377)||jp!=(j&0377))
+					break;
+				n = getshort(ifile);
+				conn = 0;
+				if(n > 0) {	/* absolute coordinates */
+					kx = ky = 0;	/* set */
+					for(k=0;k<n;k++){
+						kx = SCALERATIO*getshort(ifile);
+						ky = SCALERATIO*getshort(ifile);
+						if (((k%delta) != 0) && (k != (n-1)))
+							continue;
+						conv(kx,&g.nlat);
+						conv(ky,&g.wlon);
+						conn = plotpt(&g,conn);
+					}
+				} else {	/* differential, scaled by SCALERATI0 */
+					n = -n;
+					kx = SCALERATIO*getshort(ifile);
+					ky = SCALERATIO*getshort(ifile);
+					for(k=0; k<n; k++) {
+						c = getc(ifile);
+						if(c&0200) c|= ~0177;
+						kx += c;
+						c = getc(ifile);
+						if(c&0200) c|= ~0177;
+						ky += c;
+						if(k%delta!=0&&k!=n-1)
+							continue;
+						conv(kx,&g.nlat);
+						conv(ky,&g.wlon);
+						conn = plotpt(&g,conn);
+					}
+				}
+				if(k==1) {
+					conv(kx,&g.nlat);
+					conv(ky,&g.wlon);
+					plotpt(&g,conn);
+				}
+			}
+		}
+	fclose(ifile);
+}
+
+int
+seeable(double lat0, double lon0)
+{
+	double x, y;
+	double lat, lon;
+	for(lat=lat0;lat<=lat0+10;lat+=2*grid[2])
+		for(lon=lon0;lon<=lon0+10;lon+=2*grid[2])
+			if(normproj(lat,lon,&x,&y)*vflag>0)
+				return(1);
+	return(0);
+}
+
+void
+satellite(struct file *t)
+{
+	char sym[50];
+	char lbl[50];
+	double scale;
+	int conn;
+	double lat,lon;
+	struct place place;
+	static FILE *ifile;
+	ifile = stdin;
+	if(t->name[0]!='-'||t->name[1]!=0) {
+		fclose(ifile);
+		if((ifile=fopen(t->name,"r"))==NULL)
+			filerror("can't find track", t->name);
+	}
+	comment("track",t->name);
+	color(t->color);
+	weight(t->weight);
+	pen(t->style);
+	for(;;) {
+		conn = 0;
+		while(!feof(ifile) && fscanf(ifile,"%lf%lf",&lat,&lon)==2){
+			latlon(lat,lon,&place);
+			if(fscanf(ifile,"%1s",lbl) == 1) {
+				if(strchr("+-.0123456789",*lbl)==0)
+					break;
+				ungetc(*lbl,ifile);
+			}
+			conn = plotpt(&place,conn);
+		}
+		if(feof(ifile))
+			return;
+		fscanf(ifile,"%[^\n]",lbl+1);
+		switch(*lbl) {
+		case '"':
+			if(plotpt(&place,conn))
+				text(lbl+1);
+			break;
+		case ':':
+		case '!':
+			if(sscanf(lbl+1,"%s %lf",sym,&scale) <= 1)
+				scale = 1;
+			if(plotpt(&place,conn?conn:-1)) {
+				int r = *lbl=='!'?0:rflag?-1:1;
+				pen(SOLID);
+				if(putsym(&place,sym,scale,r) == 0)
+					text(lbl);
+				pen(t->style);
+			}
+			break;
+		default:
+			if(plotpt(&place,conn))
+				text(lbl);
+			break;
+		}
+	}
+}
+
+int
+pnorm(double x)
+{
+	int i;
+	i = x/10.;
+	i %= 36;
+	if(i>=18) return(i-36);
+	if(i<-18) return(i+36);
+	return(i);
+}
+
+void
+error(char *s)
+{
+	fprintf(stderr,"\r\n%s: %s\n",version,s);
+	exit(1);
+}
+
+void
+filerror(char *s, char *f)
+{
+	fprintf(stderr,"\r\n%s: %s %s\n",version,s,f);
+	exit(1);
+}
+
+char *
+mapindex(char *s)
+{
+	char *t = malloc(strlen(s)+3);
+	strcpy(t,s);
+	strcat(t,".x");
+	return t;
+}
+
+#define NOPT 32767
+static int ox = NOPT, oy = NOPT;
+
+int
+cpoint(int xi, int yi, int conn)
+{
+	int dx = abs(ox-xi);
+	int dy = abs(oy-yi);
+	if(!xflag && (xi<left||xi>=right || yi<bottom||yi>=top)) {
+		ox = oy = NOPT;
+		return 0;
+	}
+	if(conn == -1)		/* isolated plotting symbol */
+		;
+	else if(!conn)
+		point(xi,yi);
+	else {
+		if(dx+dy>longlines) {
+			ox = oy = NOPT;	/* don't leap across cuts */
+			return 0;
+		}
+		if(dx || dy)
+			vec(xi,yi);
+	}
+	ox = xi, oy = yi;
+	return dx+dy<=2? 2: 1;	/* 2=very near; see dogrid */
+}
+
+
+struct place oldg;
+
+int
+plotpt(struct place *g, int conn)
+{
+	int kx,ky;
+	int ret;
+	double cutlon;
+	if(!inlimits(g)) {
+		return(0);
+}
+	normalize(g);
+	if(!inwindow(g)) {
+		return(0);
+}
+	switch((*cut)(g,&oldg,&cutlon)) {
+	case 2:
+		if(conn) {
+			ret = duple(g,cutlon)|duple(g,cutlon);
+			oldg = *g;
+			return(ret);
+		}
+	case 0:
+		conn = 0;
+	default:	/* prevent diags about bad return value */
+	case 1:
+		oldg = *g;
+		ret = doproj(g,&kx,&ky);
+		if(ret==0 || (!onlimb && ret*vflag<=0))
+			return(0);
+		ret = cpoint(kx,ky,conn);
+		return ret;
+	}
+}
+
+int
+doproj(struct place *g, int *kx, int *ky)
+{
+	int i;
+	double x,y,x1,y1;
+/*fprintf(stderr,"dopr1 %f %f \n",g->nlat.l,g->wlon.l);*/
+	i = fixproj(g,&x,&y);
+	if(i == 0)
+		return(0);
+	if(rflag)
+		x = -x;
+/*fprintf(stderr,"dopr2 %f %f\n",x,y);*/
+	if(!inpoly(x,y)) {
+		return 0;
+}
+	x1 = x - xcent;
+	y1 = y - ycent;
+	x = (x1*crot.c - y1*crot.s + xoff)*scaling;
+	y = (x1*crot.s + y1*crot.c + yoff)*scaling;
+	*kx = x + (x>0?.5:-.5);
+	*ky = y + (y>0?.5:-.5);
+	return(i);
+}
+
+int
+duple(struct place *g, double cutlon)
+{
+	int kx,ky;
+	int okx,oky;
+	struct place ig;
+	revlon(g,cutlon);
+	revlon(&oldg,cutlon);
+	ig = *g;
+	invert(&ig);
+	if(!inlimits(&ig))
+		return(0);
+	if(doproj(g,&kx,&ky)*vflag<=0 ||
+	   doproj(&oldg,&okx,&oky)*vflag<=0)
+		return(0);
+	cpoint(okx,oky,0);
+	cpoint(kx,ky,1);
+	return(1);
+}
+
+void
+revlon(struct place *g, double cutlon)
+{
+	g->wlon.l = reduce(cutlon-reduce(g->wlon.l-cutlon));
+	trig(&g->wlon);
+}
+
+
+/*	recognize problems of cuts
+ *	move a point across cut to side of its predecessor
+ *	if its very close to the cut
+ *	return(0) if cut interrupts the line
+ *	return(1) if line is to be drawn normally
+ *	return(2) if line is so close to cut as to
+ *	be properly drawn on both sheets
+*/
+
+int
+picut(struct place *g, struct place *og, double *cutlon)
+{
+	*cutlon = PI;
+	return(ckcut(g,og,PI));
+}
+
+int
+nocut(struct place *g, struct place *og, double *cutlon)
+{
+/*
+#pragma	ref g
+#pragma	ref og
+#pragma	ref cutlon
+*/
+	return(1);
+}
+
+int
+ckcut(struct place *g1, struct place *g2, double lon)
+{
+	double d1, d2;
+	double f1, f2;
+	int kx,ky;
+	d1 = reduce(g1->wlon.l -lon);
+	d2 = reduce(g2->wlon.l -lon);
+	if((f1=fabs(d1))<FUZZ)
+		d1 = diddle(g1,lon,d2);
+	if((f2=fabs(d2))<FUZZ) {
+		d2 = diddle(g2,lon,d1);
+		if(doproj(g2,&kx,&ky)*vflag>0)
+			cpoint(kx,ky,0);
+	}
+	if(f1<FUZZ&&f2<FUZZ)
+		return(2);
+	if(f1>PI*TWO_THRD||f2>PI*TWO_THRD)
+		return(1);
+	return(d1*d2>=0);
+}
+
+double
+diddle(struct place *g, double lon, double d)
+{
+	double d1;
+	d1 = FUZZ/2;
+	if(d<0)
+		d1 = -d1;
+	g->wlon.l = reduce(lon+d1);
+	trig(&g->wlon);
+	return(d1);
+}
+
+double
+reduce(double lon)
+{
+	if(lon>PI)
+		lon -= 2*PI;
+	else if(lon<-PI)
+		lon += 2*PI;
+	return(lon);
+}
+
+
+double tetrapt = 35.26438968;	/* atan(1/sqrt(2)) */
+
+void
+dogrid(double lat0, double lat1, double lon0, double lon1)
+{
+	double slat,slon,tlat,tlon;
+	register int conn, oconn;
+	slat = tlat = slon = tlon = 0;
+	if(lat1>lat0)
+		slat = tlat = fmin(grid[2],dlat);
+	else
+		slon = tlon = fmin(grid[2],dlon);;
+	conn = oconn = 0;
+	while(lat0<=lat1&&lon0<=lon1) {
+		conn = gridpt(lat0,lon0,conn);
+		if(projection==Xguyou&&slat>0) {
+			if(lat0<-45&&lat0+slat>-45)
+				conn = gridpt(-45.,lon0,conn);
+			else if(lat0<45&&lat0+slat>45)
+				conn = gridpt(45.,lon0,conn);
+		} else if(projection==Xtetra&&slat>0) {
+			if(lat0<-tetrapt&&lat0+slat>-tetrapt) {
+				gridpt(-tetrapt-.001,lon0,conn);
+				conn = gridpt(-tetrapt+.001,lon0,0);
+			}
+			else if(lat0<tetrapt&&lat0+slat>tetrapt) {
+				gridpt(tetrapt-.001,lon0,conn);
+				conn = gridpt(tetrapt+.001,lon0,0);
+			}
+		}
+		if(conn==0 && oconn!=0) {
+			if(slat+slon>.05) {
+				lat0 -= slat;	/* steps too big */
+				lon0 -= slon;	/* or near bdry */
+				slat /= 2;
+				slon /= 2;
+				conn = oconn = gridpt(lat0,lon0,conn);
+			} else
+				oconn = 0;
+		} else {
+			if(conn==2) {
+				slat = tlat;
+				slon = tlon;
+				conn = 1;
+			}
+			oconn = conn;
+	 	}
+		lat0 += slat;
+		lon0 += slon;
+	}
+	gridpt(lat1,lon1,conn);
+}
+
+static int gridinv;	/* nonzero when doing window bounds */
+
+int
+gridpt(double lat, double lon, int conn)
+{
+	struct place g;
+/*fprintf(stderr,"%f %f\n",lat,lon);*/
+	latlon(lat,lon,&g);
+	if(gridinv)
+		invert(&g);
+	return(plotpt(&g,conn));
+}
+
+/* win=0 ordinary grid lines, win=1 window lines */
+
+void
+dobounds(double lolat, double hilat, double lolon, double hilon, int win)
+{
+	gridinv = win;
+	if(lolat>-90 || (win && (poles&1)!=0))
+		dogrid(lolat+FUZZ,lolat+FUZZ,lolon,hilon);
+	if(hilat<90 || (win && (poles&2)!=0))
+		dogrid(hilat-FUZZ,hilat-FUZZ,lolon,hilon);
+	if(hilon-lolon<360 || (win && cut==picut)) {
+		dogrid(lolat,hilat,lolon+FUZZ,lolon+FUZZ);
+		dogrid(lolat,hilat,hilon-FUZZ,hilon-FUZZ);
+	}
+	gridinv = 0;
+}
+
+static void
+dolimb(void)
+{
+	double lat, lon;
+	double res = fmin(dlat, dlon)/4;
+	int conn = 0;
+	int newconn;
+	if(limb == 0)
+		return;
+	onlimb = gridinv = 1;
+	for(;;) {
+		newconn = (*limb)(&lat, &lon, res);
+		if(newconn == -1)
+			break;
+		conn = gridpt(lat, lon, conn*newconn);
+	}
+	onlimb = gridinv = 0;
+}
+
+
+void
+radbds(double *w, double *rw)
+{
+	int i;
+	for(i=0;i<4;i++)
+		rw[i] = w[i]*RAD;
+	rw[0] -= FUZZ;
+	rw[1] += FUZZ;
+	rw[2] -= FUZZ;
+	rw[3] += FUZZ;
+}
+
+void
+windlim(void)
+{
+	double center = orientation[0];
+	double colat;
+	if(center>90)
+		center = 180 - center;
+	if(center<-90)
+		center = -180 - center;
+	if(fabs(center)>90)
+		error("unreasonable orientation");
+	colat = 90 - window[0];
+	if(center-colat>limits[0])
+		limits[0] = center - colat;
+	if(center+colat<limits[1])
+		limits[1] = center + colat;
+}
+
+
+short
+getshort(FILE *f)
+{
+	int c, r;
+	c = getc(f);
+	r = (c | getc(f)<<8);
+	if (r&0x8000)
+		r |= ~0xFFFF;	/* in case short > 16 bits */
+	return r;
+}
+
+double
+fmin(double x, double y)
+{
+	return(x<y?x:y);
+}
+
+double
+fmax(double x, double y)
+{
+	return(x>y?x:y);
+}
+
+void
+clamp(double *px, double v)
+{
+	*px = (v<0?fmax:fmin)(*px,v);
+}
+
+void
+pathnames(void)
+{
+	int i;
+	char *t, *indexfile, *name;
+	FILE *f, *fx;
+	for(i=0; i<nfile; i++) {
+		name = file[i].name;
+		if(*name=='/')
+			continue;
+		indexfile = mapindex(name);
+			/* ansi equiv of unix access() call */
+		f = fopen(name, "r");
+		fx = fopen(indexfile, "r");
+		if(f) fclose(f);
+		if(fx) fclose(fx);
+		free(indexfile);
+		if(f && fx)
+			continue;
+		t = malloc(strlen(name)+strlen(mapdir)+2);
+		strcpy(t,mapdir);
+		strcat(t,"/");
+		strcat(t,name);
+		file[i].name = t;
+	}
+}
+
+void
+clipinit(void)
+{
+	int i;
+	double s,t;
+	if(nvert<=0)
+		return;
+	for(i=0; i<nvert; i++) {	/*convert latlon to xy*/
+		if(normproj(v[i].x,v[i].y,&v[i].x,&v[i].y)==0)
+			error("invisible clipping vertex");
+	}
+	if(nvert==2) {			/*rectangle with diag specified*/
+		nvert = 4;
+		v[2] = v[1];
+		v[1].x=v[0].x, v[1].y=v[2].y, v[3].x=v[2].x, v[3].y=v[0].y;
+	}	
+	v[nvert] = v[0];
+	v[nvert+1] = v[1];
+	s = 0;
+	for(i=1; i<=nvert; i++) {	/*test for convexity*/
+		t = (v[i-1].x-v[i].x)*(v[i+1].y-v[i].y) -
+		    (v[i-1].y-v[i].y)*(v[i+1].x-v[i].x);
+		if(t<-FUZZ && s>=0) s = 1;
+		if(t>FUZZ && s<=0) s = -1;
+		if((-FUZZ<=t&&t<=FUZZ) || t*s>0) {
+			s = 0;
+			break;
+		}
+	}
+	if(s==0)
+		error("improper clipping polygon");
+	for(i=0; i<nvert; i++) {	/*edge equation ax+by=c*/
+		e[i].a = s*(v[i+1].y - v[i].y);
+		e[i].b = s*(v[i].x - v[i+1].x);
+		e[i].c = s*(v[i].x*v[i+1].y - v[i].y*v[i+1].x);
+	}
+}
+
+int
+inpoly(double x, double y)
+{
+	int i;
+	for(i=0; i<nvert; i++) {
+		register struct edge *ei = &e[i];
+		double val = x*ei->a + y*ei->b - ei->c;
+		if(val>10*FUZZ)
+			return(0);
+	}
+	return 1;
+}
+
+void
+realcut()
+{
+	struct place g;
+	double lat;
+	
+	if(cut != picut)	/* punt on unusual cuts */
+		return;
+	for(lat=window[0]; lat<=window[1]; lat+=grid[2]) {
+		g.wlon.l = PI;
+		trig(&g.wlon);
+		g.nlat.l = lat*RAD;
+		trig(&g.nlat);
+		if(!inwindow(&g)) {
+			break;
+}
+		invert(&g);
+		if(inlimits(&g)) {
+			return;
+}
+	}
+	longlines = shortlines = LONGLINES;
+	cut = nocut;		/* not necessary; small eff. gain */
+}
diff --git a/src/doug/map.h b/src/doug/map.h
new file mode 100644
index 0000000..21ce333
--- /dev/null
+++ b/src/doug/map.h
@@ -0,0 +1,156 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifndef PI
+#define PI	3.1415926535897932384626433832795028841971693993751
+#endif
+
+#define TWOPI (2*PI)
+#define RAD (PI/180)
+double	hypot(double, double);	/* sqrt(a*a+b*b) */
+double	tan(double);		/* not in K&R library */
+
+#define ECC .08227185422	/* eccentricity of earth */
+#define EC2 .006768657997
+
+#define FUZZ .0001
+#define UNUSED 0.0		/* a dummy double parameter */
+
+struct coord {
+	double l;	/* lat or lon in radians*/
+	double s;	/* sin */
+	double c;	/* cos */
+};
+struct place {
+	struct coord nlat;
+	struct coord wlon;
+};
+
+typedef int (*proj)(struct place *, double *, double *);
+
+struct pindex {		/* index of known projections */
+	char *name;	/* name of projection */
+	proj (*prog)(double, double);
+			/* pointer to projection function */
+	int npar;	/* number of params */
+	int (*cut)(struct place *, struct place *, double *);
+			/* function that handles cuts--eg longitude 180 */
+	int poles;	/*1 S pole is a line, 2 N pole is, 3 both*/
+	int spheroid;	/* poles must be at 90 deg if nonzero */
+	int (*limb)(double *lat, double *lon, double resolution);
+			/* get next place on limb */
+			/* return -1 if done, 0 at gap, else 1 */
+};
+
+
+proj	aitoff(void);
+proj	albers(double, double);
+int	Xazequalarea(struct place *, double *, double *);
+proj	azequalarea(void);
+int	Xazequidistant(struct place *, double *, double *);
+proj	azequidistant(void);
+proj	bicentric(double);
+proj	bonne(double);
+proj	conic(double);
+proj	cylequalarea(double);
+int	Xcylindrical(struct place *, double *, double *);
+proj	cylindrical(void);
+proj	eisenlohr(void);
+proj	elliptic(double);
+int	elimb(double*, double*, double);
+proj	fisheye(double);
+proj	gall(double);
+proj	gilbert(void);
+proj	globular(void);
+proj	gnomonic(void);
+int	guycut(struct place *, struct place *, double *);
+int	Xguyou(struct place *, double *, double *);
+proj	guyou(void);
+proj	harrison(double, double);
+int	hexcut(struct place *, struct place *, double *);
+proj	hex(void);
+proj	homing(double);
+int	hlimb(double*, double*, double resolution);
+proj	lagrange(void);
+proj	lambert(double, double);
+proj	laue(void);
+proj	lune(double, double);
+proj	loxodromic(double);	/* not in library */
+proj	mecca(double);
+int	mlimb(double*, double*, double resolution);
+proj	mercator(void);
+proj	mollweide(void);
+proj	newyorker(double);
+proj	ortelius(double, double);	/* not in library */
+int	Xorthographic(struct place *place, double *x, double *y);
+proj	orthographic(void);
+int	olimb(double*, double*, double);
+proj	perspective(double);
+int	plimb(double*, double*, double resolution);
+int	Xpolyconic(struct place *, double *, double *);
+proj	polyconic(void);
+proj	rectangular(double);
+proj	simpleconic(double, double);
+int	Xsinusoidal(struct place *, double *, double *);
+proj	sinusoidal(void);
+proj	sp_albers(double, double);
+proj	sp_mercator(void);
+proj	square(void);
+int	Xstereographic(struct place *, double *, double *);
+proj	stereographic(void);
+int	Xtetra(struct place *, double *, double *);
+int	tetracut(struct place *, struct place *, double *);
+proj	tetra(void);
+proj	trapezoidal(double, double);
+proj	vandergrinten(void);
+proj	wreath(double, double);	/* not in library */
+
+void	findxy(double, double *, double *);
+void	albscale(double, double, double, double);
+void	invalb(double, double, double *, double *);
+
+void	cdiv(double, double, double, double, double *, double *);
+void	cmul(double, double, double, double, double *, double *);
+void	cpow(double, double, double *, double *, double);
+void	csq(double, double, double *, double *);
+void	csqrt(double, double, double *, double *);
+void	ccubrt(double, double, double *, double *);
+double	cubrt(double);
+int	elco2(double, double, double, double, double, double *, double *);
+void	cdiv2(double, double, double, double, double *, double *);
+void	csqr(double, double, double *, double *);
+
+void	orient(double, double, double);
+void	latlon(double, double, struct place *);
+void	deg2rad(double, struct coord *);
+double	trigclamp(double);
+void	trig(struct coord *);
+void	normalize(struct place *);
+void	invert(struct place *);
+void	norm(struct place *, struct place *, struct coord *);
+void	printp(struct place *);
+void	copyplace(struct place *, struct place *);
+
+int	picut(struct place *, struct place *, double *);
+int	ckcut(struct place *, struct place *, double);
+double	reduce(double);
+
+void	getsyms(char *);
+int	putsym(struct place *, char *, double, int);
+void	filerror(char *s, char *f);
+void	error(char *s);
+int	doproj(struct place *, int *, int *);
+int	cpoint(int, int, int);
+int	plotpt(struct place *, int);
+int	nocut(struct place *, struct place *, double *);
+
+extern int (*projection)(struct place *, double *, double *);
diff --git a/src/doug/map.sh b/src/doug/map.sh
new file mode 100755
index 0000000..6a5d66d
--- /dev/null
+++ b/src/doug/map.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+# /************************************************************
+# 
+# Copyright (C) 1998, Lucent Technologies
+# All rights reserved
+# 
+# ************************************************************/
+# 
+# MF -m -f or "", M map files, A other arguments
+# MFLAG and FFLAG 0 or 1 for -m or -f ever used
+
+MAPHOME=${MAPHOME-/usr/lib/map}
+MAPPROG=${MAPPROG-$MAPHOME/bin/map}
+MAPDIR=${MAPDIR-$MAPHOME/lib}
+M= A= MF= MFLAG=0 FFLAG=0
+for i in $*
+do
+	case $i in
+	-m)
+		MF=-m MFLAG=1 ;;
+	-f)
+		MF=-f FFLAG=1 ;;
+	-*)
+		MF= A="$A $i" ;;
+	*)
+		case $MF$i in
+		-m*)		M="$M $i" ;;
+		-friv*4)	M="$M 201 202 203 204";;
+		-friv*3)	M="$M 201 202 203";;
+		-friv*2)	M="$M 201 202";;
+		-friv*)		M="$M 201";;
+		-firiv*[34])	M="$M 206 207 208";;
+		-firiv*2)	M="$M 206 207";;
+		-firiv*)	M="$M 206";;
+		-fcoast*4|-fshore*4|-flake*4)	M="$M 102 103 104";;
+		-fcoast*3|-fshore*3|-flake*3)	M="$M 102 103";;
+		-fcoast*2|-fshore*2|-flake*2)	M="$M 102";;
+		-fcoast*|-fshore*|-flake*)	M="$M 101";;
+		-filake*[234]|-fishore*[234])	M="$M 106 107";;
+		-filake*|-fishore*)		M="$M 106";;
+		-freef*)	M="$M 108";;
+		-fcanal*[34])	M="$M 210 211 212";;
+		-fcanal*2)	M="$M 210 211";;
+		-fcanal*)	M="$M 210";;
+		-fglacier*)	M="$M 115";;
+		-fstate*|-fprovince*)		M="$M 401";;
+		-fcountr*[34])	M="$M 301 302 303";;
+		-fcountr*2)	M="$M 301 302";;
+		-fcountr*)	M="$M 301";;
+		-fsalt*[234])	M="$M 109 110";;
+		-fsalt*)	M="$M 109";;
+		-fice*[234]|-fshel*[234])	M="$M 113 114";;
+		-fice*|-fshel*)			M="$M 113";;
+		-f*)	echo map: unknown feature $i 1>&2
+			exit 1 ;;
+		*)
+			A="$A $i" MF=
+		esac
+	esac
+done
+
+case "$MFLAG$FFLAG$M " in
+00)
+	: ;;
+1* | *" 101 "*)
+	M="-m $M" ;;
+01*)
+	M="-m 101 $M"
+esac
+
+MAP=${MAP-world} MAPDIR=$MAPDIR $MAPPROG $A $M
diff --git a/src/doug/map.tar b/src/doug/map.tar
new file mode 100644
index 0000000..6d4833f
Binary files /dev/null and b/src/doug/map.tar differ
diff --git a/src/doug/mapdata/counties b/src/doug/mapdata/counties
new file mode 100644
index 0000000..a67dae4
Binary files /dev/null and b/src/doug/mapdata/counties differ
diff --git a/src/doug/mapdata/counties.x b/src/doug/mapdata/counties.x
new file mode 100644
index 0000000..8fefaa2
--- /dev/null
+++ b/src/doug/mapdata/counties.x
@@ -0,0 +1,16 @@
+2 8 0
+2 9 6184
+2 10 12868
+3 7 13876
+3 8 38744
+3 9 113000
+3 10 151516
+3 11 163016
+3 12 170052
+4 6 175196
+4 7 177776
+4 8 197904
+4 9 213732
+4 10 233712
+4 11 245552
+4 12 259340
diff --git a/src/doug/mapdata/states b/src/doug/mapdata/states
new file mode 100644
index 0000000..46ab700
Binary files /dev/null and b/src/doug/mapdata/states differ
diff --git a/src/doug/mapdata/states.x b/src/doug/mapdata/states.x
new file mode 100644
index 0000000..ff6b82b
--- /dev/null
+++ b/src/doug/mapdata/states.x
@@ -0,0 +1,16 @@
+2 8 0
+2 9 2744
+2 10 5444
+3 7 6108
+3 8 14280
+3 9 21900
+3 10 25600
+3 11 26404
+3 12 27448
+4 6 28664
+4 7 29940
+4 8 34752
+4 9 39396
+4 10 42748
+4 11 43364
+4 12 44640
diff --git a/src/doug/mapdata/world b/src/doug/mapdata/world
new file mode 100644
index 0000000..09f9c8d
Binary files /dev/null and b/src/doug/mapdata/world differ
diff --git a/src/doug/mapdata/world.x b/src/doug/mapdata/world.x
new file mode 100644
index 0000000..c96c7d6
--- /dev/null
+++ b/src/doug/mapdata/world.x
@@ -0,0 +1,348 @@
+-8 -18 0
+-8 -17 72
+-8 -4 564
+-8 -3 580
+-8 -2 692
+-8 -1 748
+-8 0 888
+-8 1 1016
+-8 2 1184
+-8 3 1324
+-8 4 1400
+-8 5 1512
+-8 6 1628
+-8 7 1800
+-8 8 2212
+-8 9 2292
+-8 10 2520
+-8 11 2864
+-8 12 2964
+-8 13 3068
+-8 14 3152
+-8 15 3288
+-8 16 3376
+-8 17 3428
+-7 -17 3472
+-7 -16 3532
+-7 -15 3648
+-7 -14 3824
+-7 -13 3968
+-7 -12 4172
+-7 -11 4320
+-7 -10 4504
+-7 -9 4656
+-7 -8 4796
+-7 -7 4972
+-7 -6 5080
+-7 -5 5324
+-7 -4 5532
+-7 -3 5728
+-7 -2 5780
+-7 -1 5904
+-7 0 6004
+-7 4 6096
+-7 5 6192
+-7 6 6716
+-7 7 7832
+-7 9 8044
+-6 -17 8096
+-6 2 8196
+-6 3 8244
+-6 5 8572
+-6 6 9000
+-6 7 10720
+-5 -18 13308
+-5 -17 14172
+-5 -15 14764
+-5 -8 15224
+-5 -7 15340
+-5 -4 15564
+-5 6 15608
+-5 7 16172
+-5 17 18260
+-4 -18 18340
+-4 -16 19248
+-4 -15 19544
+-4 -14 19956
+-4 -13 20640
+-4 -12 20836
+-4 -4 21108
+-4 -3 21140
+-4 -2 21392
+-4 5 21612
+-4 6 22368
+-4 7 22456
+-3 -17 22772
+-3 -16 23200
+-3 -15 23572
+-3 -12 23708
+-3 -6 24212
+-3 -5 24328
+-3 -4 24556
+-3 -2 24872
+-3 4 25184
+-3 5 25652
+-3 7 25668
+-3 10 25960
+-3 12 25996
+-3 13 26024
+-3 14 26112
+-3 17 26148
+-2 -18 26196
+-2 -17 26508
+-2 -16 27216
+-2 -15 27344
+-2 -14 27936
+-2 -13 29000
+-2 -12 29804
+-2 -6 29836
+-2 -5 29884
+-2 -4 30668
+-2 -2 31180
+-2 3 31532
+-2 4 31824
+-2 6 31844
+-2 7 31968
+-2 14 32344
+-2 15 32656
+-2 16 32716
+-2 17 32752
+-1 -18 32948
+-1 -17 33012
+-1 -16 33288
+-1 -15 34468
+-1 -14 35472
+-1 -13 37056
+-1 -12 39304
+-1 -11 40872
+-1 -10 41988
+-1 -6 42076
+-1 -5 42096
+-1 -4 42248
+-1 -3 43072
+-1 -2 43240
+-1 -1 43460
+-1 1 43532
+-1 3 43560
+-1 4 43720
+-1 5 44188
+-1 7 44288
+-1 8 44448
+-1 9 44768
+-1 13 45004
+-1 14 45072
+-1 15 45120
+-1 17 45160
+0 -18 45236
+0 -17 45400
+0 -16 45584
+0 -14 45684
+0 -13 45764
+0 -12 47296
+0 -11 48400
+0 -10 49476
+0 -9 50196
+0 -8 50356
+0 -6 50536
+0 -5 50580
+0 -4 50792
+0 -1 50972
+0 0 51620
+0 1 51812
+0 4 52072
+0 5 52120
+0 6 52580
+0 7 52708
+0 8 53308
+0 9 53764
+0 15 53796
+0 16 53892
+0 17 53916
+1 -17 53948
+1 -15 54056
+1 -13 54224
+1 -12 56128
+1 -11 56416
+1 -10 57192
+1 -9 57828
+1 -8 58072
+1 -6 58492
+1 -5 58936
+1 -4 59768
+1 -2 59928
+1 1 60120
+1 2 60576
+1 6 60820
+1 7 62072
+1 8 62932
+1 9 63672
+1 10 64228
+1 11 64484
+1 15 64508
+2 -16 64648
+2 -15 64692
+2 -13 64720
+2 -12 65464
+2 -11 66204
+2 -10 66360
+2 -9 66548
+2 -8 66764
+2 -7 67064
+2 -6 67468
+2 -5 68372
+2 -4 68616
+2 0 69452
+2 1 69488
+2 7 70016
+2 8 71176
+2 9 72104
+2 10 73332
+2 11 73816
+2 15 75180
+2 17 75572
+3 -15 75580
+3 -14 75752
+3 -13 77028
+3 -12 78536
+3 -6 78716
+3 -5 78928
+3 -4 79136
+3 -3 80084
+3 -2 81932
+3 -1 83004
+3 0 83644
+3 1 84380
+3 2 84452
+3 3 84680
+3 6 84708
+3 7 84760
+3 8 85976
+3 9 86392
+3 11 86424
+3 12 87160
+4 -16 87612
+4 -15 87784
+4 -14 88960
+4 -13 89368
+4 -8 89532
+4 -7 89788
+4 -6 89980
+4 -5 90648
+4 -4 91008
+4 -3 92300
+4 -2 93132
+4 -1 94424
+4 0 95264
+4 5 95992
+4 6 96796
+4 7 98656
+4 8 99936
+4 9 102112
+4 11 102220
+4 12 102448
+5 -18 103816
+5 -17 104144
+5 -16 104952
+5 -15 105704
+5 -14 106472
+5 -11 106988
+5 -4 107300
+5 -3 107340
+5 -2 108440
+5 -1 110524
+5 0 112336
+5 1 116136
+5 4 116192
+5 5 116280
+5 6 117148
+5 7 118412
+5 8 119224
+5 9 119808
+5 10 120788
+5 11 121132
+5 12 121268
+5 13 122476
+5 14 127280
+5 15 127484
+5 16 129660
+5 17 131300
+6 -18 131844
+6 -17 133124
+6 -16 134228
+6 -8 134456
+6 -7 135420
+6 -6 135880
+6 -5 136460
+6 -4 137344
+6 -3 138756
+6 -2 140292
+6 -1 142892
+6 0 144212
+6 1 144724
+6 2 145316
+6 3 146636
+6 4 147524
+6 5 148892
+6 6 149884
+6 7 151804
+6 8 153892
+6 9 156468
+6 10 158512
+6 11 160036
+6 12 162656
+6 13 164080
+6 14 165180
+6 15 166240
+6 16 166612
+6 17 169336
+7 -18 170928
+7 -17 171072
+7 -16 171116
+7 -15 171508
+7 -14 173468
+7 -13 174860
+7 -12 175564
+7 -11 176844
+7 -10 178844
+7 -9 180760
+7 -8 182292
+7 -7 183388
+7 -6 184268
+7 -5 186512
+7 -4 186544
+7 -3 186616
+7 -2 190928
+7 0 194552
+7 1 194620
+7 2 195448
+7 5 197896
+7 6 198656
+7 7 199736
+7 8 202044
+7 9 207688
+7 10 214092
+7 11 218616
+7 12 222772
+7 13 224100
+7 14 224144
+7 15 224376
+7 16 225000
+7 17 225180
+8 -10 225368
+8 -9 226260
+8 -8 226360
+8 -7 226416
+8 -6 227624
+8 -5 231152
+8 -4 232856
+8 -3 233184
+8 -2 234484
+8 1 235188
+8 2 235852
+8 3 236912
+8 4 237804
+8 5 239208
+8 6 239884
+8 7 241368
+8 8 242528
+8 9 245064
diff --git a/src/doug/plot.h b/src/doug/plot.h
new file mode 100644
index 0000000..1de877f
--- /dev/null
+++ b/src/doug/plot.h
@@ -0,0 +1,53 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+/* Plotting functions */
+
+/* open the plotting output */
+extern void openpl(void);
+
+/* close the plotting output */
+extern void closepl(void);
+
+/* make sure the page or screen is clear */
+extern void erase(void);
+
+/* plot a point at x,y which becomes current */
+extern void point(int x, int y);
+
+/* coordinates to be assigned to lower left and upper right
+   corners of (square) plotting area */
+extern void range(int xmin, int ymin, int xmax, int ymax);
+
+/* place text, first letter at current point, which does not change */
+extern void text(char *);
+
+/* draw line from current point to x,y which becomes current */
+extern void vec(int x, int y);
+
+/* x,y becomes current point */
+extern void move(int x, int y);
+
+/* specify style for drawing lines */
+
+#define SOLID "solid"
+#define DOTTED "dotted"
+#define DOTDASH "dotdash"
+
+extern void pen(char *);
+
+#define BLACK "black"
+#define RED "red"
+#define GREEN "green"
+#define BLUE "blue"
+
+extern void color(char *);
+
+extern void weight(double);
+
+extern void comment(char *, char *);
+
diff --git a/src/doug/plot0.c b/src/doug/plot0.c
new file mode 100644
index 0000000..d790b8c
--- /dev/null
+++ b/src/doug/plot0.c
@@ -0,0 +1,8 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+/* program intentionally left blank */
diff --git a/src/doug/plotPS.c b/src/doug/plotPS.c
new file mode 100644
index 0000000..4c51332
--- /dev/null
+++ b/src/doug/plotPS.c
@@ -0,0 +1,159 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "plot.h"
+#include <stdio.h>
+#include <string.h>
+
+/* Plotting functions for PostScript */
+
+static double _a,_b,_c,_d, _ox, _oy;
+static double width = 0;
+
+#define xs(_x) (_ox = _a*(_x)+_b)
+#define ys(_y) (_oy = _c*(_y)+_d)
+
+void
+range(int xmin, int ymin, int xmax, int ymax)
+{
+	_a = 6.5*72/(xmax-xmin);
+	_b = -_a*xmin + 1.0*72;
+	_c = 6.5*72/(ymax-ymin);
+	_d = -_c*ymin + 3.5*72;
+}
+
+
+/* open the plotting output */
+void
+erase(void)
+{
+	printf("%%!PS\n"
+		"%%Creator: map\n"
+		"%%BoundingBox: 72 252 540 720\n"
+		"%%EndComments\n"
+		"/co /sethsbcolor load def\n"
+		"/m /moveto load def\n"
+		"/s /stroke load def\n"
+		"/t {gsave newpath 0 0 moveto (X) true charpath "
+		"flattenpath pathbbox /charht exch def pop pop pop grestore "
+		"charht 2 div sub moveto show} bind def\n"
+		"/v /lineto load def\n"
+		"%%EndProlog\n"
+		"gsave\n"
+		"/Helvetica findfont 10 scalefont setfont\n"
+		"1 setlinecap\n"
+		"1 setlinejoin\n"
+		".5 setlinewidth\n"
+		"newpath\n"
+		"72 72 m\n");
+}
+
+/* close the plotting output */
+void
+closepl(void)
+{
+	printf("showpage\ngrestore\n");
+}
+
+/* make sure the page or screen is clear (on some old systems) */
+void
+openpl(void)
+{
+	printf("");
+}
+
+/* plot a point at _x,_y, which becomes current */
+void
+point(int _x, int _y)
+{
+	printf("s\n%.1f %.1f m\n",xs(_x),ys(_y));
+}
+
+/* place text, first letter at current point, which does not change */
+void
+text(char *_s)
+{
+	printf("(%s) %.1f %.1f t\n",_s,_ox,_oy);
+}
+
+/* draw line from current point to _x,_y, which becomes current */
+void
+vec(int _x, int _y)
+{
+	printf("%.1f %.1f v\n", xs(_x),ys(_y));
+}
+
+/* _x,_y becomes current point */
+void
+move(int _x, int _y)
+{
+	printf("s\n%.1f %.1f m\n", xs(_x), ys(_y));
+}
+
+struct dashpat {
+	char *name;
+	char *pat;
+	double width;
+} pattern[] = {
+	{ SOLID, "[] 0", .5 },		/* pattern, minimum acceptable width */
+	{ DOTTED, "[3 6] 0", 0 },
+	{ DOTDASH, "[18 6 3 6] 0", .5}
+};
+
+/* specify style for drawing lines: "dotted", "solid", "dotdash" */
+void
+pen(char *s)
+{
+	int i;
+	char *t;
+	double w = width;
+	for(i=0; i<sizeof(pattern)/sizeof(*pattern); i++)
+		if(strcmp(s,pattern[i].name) == 0)
+			break;
+	if(i >= sizeof(pattern)/sizeof(*pattern)) {
+		while((t = strchr(s, ',')))
+			*t = ' ';
+	} else if(width <= pattern[i].width)
+		w = pattern[i].width;
+	printf("s\n%.2f setlinewidth\n%s setdash\n",
+		w, pattern[i].pat);
+}
+
+static struct {
+	char *name;
+	char *hsbcode;
+} colors[] = {
+	{ BLACK, "0 0 0" },
+	{ RED, "0 1 1" },
+	{ GREEN, ".33 1 1" },
+	{ BLUE, ".67 1 1" }
+};
+
+void
+color(char *s)
+{
+	char *t;
+	int i;
+	for(i=0; i<sizeof(colors)/sizeof(*colors); i++)
+		if(strcmp(s, colors[i].name) == 0)
+			s = colors[i].hsbcode;
+	while((t = strchr(s, ',')))
+		*t = ' ';
+	printf("s\n%s co\n",s);
+}
+
+void
+weight(double w)
+{
+	width = w;
+}
+
+void
+comment(char *s, char *t)
+{
+	printf("%%%s %s\n",s,t);
+}
diff --git a/src/doug/plotV.c b/src/doug/plotV.c
new file mode 100644
index 0000000..c595eb4
--- /dev/null
+++ b/src/doug/plotV.c
@@ -0,0 +1,37 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+/* Plotting functions for Sys V and BSD systems */
+
+extern void space(int, int, int, int);
+extern void cont(int, int);
+extern void label(char *);
+extern void linemod(char *);
+
+void
+range(int xmin, int ymin, int xmax, int ymax)
+{
+	space(xmin, ymin, xmax, ymax);
+}
+
+void
+text(char *s)
+{
+	label(s);
+}
+
+void
+vec(int x, int y)
+{
+	cont(x, y);
+}
+
+void
+pen(char *s)
+{
+	linemod(s);
+}
diff --git a/src/doug/route.c b/src/doug/route.c
new file mode 100644
index 0000000..033d61e
--- /dev/null
+++ b/src/doug/route.c
@@ -0,0 +1,107 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+/* Given two lat-lon pairs, find an orientation for the
+   -o option of "map" that will place those two points
+   on the equator of a standard projection, equally spaced
+   about the prime meridian.   Both an erect and an inverted
+   orientation are found.
+
+   Option -t prints out a series of
+   coordinates that follows the (great circle) track
+   in the original coordinate system,
+   followed by ".
+   This data is just right for map -t.
+*/
+struct place pole;
+struct coord twist;
+int track;
+
+extern void doroute(double, double, double, double, double);
+
+void
+dorot(double a, double b, double *x, double *y, void (*f)(struct place *))
+{
+	struct place g;
+	deg2rad(a,&g.nlat);
+	deg2rad(b,&g.wlon);
+	(*f)(&g);
+	*x = g.nlat.l/RAD;
+	*y = g.wlon.l/RAD;
+}
+
+void
+rotate(double a, double b, double *x, double *y)
+{
+	dorot(a,b,x,y,normalize);
+}
+
+void
+rinvert(double a, double b, double *x, double *y)
+{
+	dorot(a,b,x,y,invert);
+}
+
+main(int argc, char **argv)
+{
+#pragma ref argv
+	double an,aw,bn,bw;
+	track = argc>1;
+	for(;;){
+		if(scanf("%lf%lf%lf%lf",&an,&aw,&bn,&bw)!=4)
+			break;
+		doroute(-90.,an,aw,bn,bw);
+		if(!track)
+			doroute(90.,an,aw,bn,bw);
+	}
+	return 0;
+}
+
+void
+doroute(double dir, double an, double aw, double bn, double bw)
+{
+	double an1,aw1,bn1,bw1,pn,pw;
+	double theta;
+	double cn,cw,cn1,cw1;
+	int i,n;
+	orient(an,aw,0.);
+	rotate(bn,bw,&bn1,&bw1);
+/*	printf("b %f %f\n",bn1,bw1);*/
+	orient(an,aw,bw1);
+	rinvert(0.,dir,&pn,&pw);
+/*	printf("p %f %f\n",pn,pw);*/
+	orient(pn,pw,0.);
+	rotate(an,aw,&an1,&aw1);
+	rotate(bn,bw,&bn1,&bw1);
+	theta = (aw1+bw1)/2;
+/*	printf("a %f %f \n",an1,aw1);*/
+	orient(pn,pw,theta);
+	rotate(an,aw,&an1,&aw1);
+	rotate(bn,bw,&bn1,&bw1);
+	if(fabs(aw1-bw1)>180)
+		if(theta<0.) theta+=180;
+		else theta -= 180;
+	orient(pn,pw,theta);
+	rotate(an,aw,&an1,&aw1);
+	rotate(bn,bw,&bn1,&bw1);
+	if(!track) {
+		printf("-o %.4f %.4f %.4f\n",pn,pw,theta);
+		printf("A %.4f %.4f\n",an1,aw1);
+		printf("B %.4f %.4f\n",bn1,bw1);
+	} else {
+		cn1 = 0;
+		n = 1 + fabs(bw1-aw1)/.2;
+		for(i=0;i<=n;i++) {
+			cw1 = aw1 + i*(bw1-aw1)/n;
+			rinvert(cn1,cw1,&cn,&cw);
+			printf("%f %f\n",cn,cw);
+		}
+		printf("\"\n");
+	}
+}
diff --git a/src/doug/symbol.c b/src/doug/symbol.c
new file mode 100644
index 0000000..13c6779
--- /dev/null
+++ b/src/doug/symbol.c
@@ -0,0 +1,195 @@
+/************************************************************
+
+Copyright (C) 1998, Lucent Technologies
+All rights reserved
+
+************************************************************/
+
+#include "map.h"
+
+#define NSYMBOL 20
+
+enum flag { POINT,ENDSEG,ENDSYM };
+struct symb {
+	double x, y;
+	char name[10+1];
+	enum flag flag;
+} *symbol[NSYMBOL];
+
+static int nsymbol;
+static double halfrange = 1;
+extern int halfwidth;
+extern int vflag;
+
+static int	getrange(FILE *);
+static int	getsymbol(FILE *, int);
+static void	setrot(struct place *, double, int);
+static void	dorot(struct symb *, double *, double *);
+
+
+void
+getsyms(char *file)
+{
+	FILE *sf = fopen(file,"r");
+	if(sf==0)
+		filerror("cannot open", file);
+	while(nsymbol<NSYMBOL-1 && getsymbol(sf,nsymbol))
+		nsymbol++;
+	fclose(sf);
+}
+
+static int
+getsymbol(FILE *sf, int n)
+{
+	double x,y;
+	char s[2];
+	int i;
+	struct symb *sp;
+	for(;;) {
+		if(fscanf(sf,"%1s",s)==EOF)
+			return 0;
+		switch(s[0]) {
+		case ':':
+			break;
+		case 'o':
+		case 'c':	/* cl */
+			fscanf(sf,"%*[^\n]");
+			continue;
+		case 'r':
+			if(getrange(sf))
+				continue;
+		default:
+			error("-y file syntax error");
+		}
+		break;
+	}
+	sp = (struct symb*)malloc(sizeof(struct symb));
+	symbol[n] = sp;
+	if(fscanf(sf,"%10s",sp->name)!=1)
+		return 0;
+	i = 0;
+	while(fscanf(sf,"%1s",s)!=EOF) {
+		switch(s[0]) {
+		case 'r':
+			if(!getrange(sf))
+				break;
+			continue;
+		case 'm':
+			if(i>0)
+				symbol[n][i-1].flag = ENDSEG;
+			continue;
+		case ':':
+			ungetc(s[0],sf);
+			break;
+		default:
+			ungetc(s[0],sf);
+		case 'v':
+			if(fscanf(sf,"%lf %lf",&x,&y)!=2)
+				break;
+			sp[i].x = x*halfwidth/halfrange;
+			sp[i].y = y*halfwidth/halfrange;
+			sp[i].flag = POINT;
+			i++;
+			sp = symbol[n] = (struct symb*)realloc(symbol[n],
+					(i+1)*sizeof(struct symb));
+			continue;
+		}
+		break;
+	}
+	if(i>0)
+		symbol[n][i-1].flag = ENDSYM;
+	else
+		symbol[n] = 0;
+	return 1;
+}
+
+static int
+getrange(FILE *sf)
+{
+	double x,y,xmin,ymin;
+	if(fscanf(sf,"%*s %lf %lf %lf %lf",
+		&xmin,&ymin,&x,&y)!=4)
+		return 0;
+	x -= xmin;
+	y -= ymin;
+	halfrange = (x>y? x: y)/2;
+	if(halfrange<=0)
+		error("bad ra command in -y file");
+	return 1;
+}
+
+/* r=0 upright;=1 normal;=-1 reverse*/
+int
+putsym(struct place *p, char *name, double s, int r)
+{
+	int x,y,n;
+	struct symb *sp;
+	double dx,dy;
+	int conn = 0;
+	for(n=0; symbol[n]; n++)
+		if(strcmp(name,symbol[n]->name)==0)
+			break;
+	sp = symbol[n];
+	if(sp==0)
+		return 0;
+	setrot(p,s,r);
+	if(doproj(p,&x,&y)*vflag <= 0)
+		return 1;
+	for(;;) {
+		dorot(sp,&dx,&dy);
+		conn = cpoint(x+(int)dx,y+(int)dy,conn);
+		switch(sp->flag) {
+		case ENDSEG:
+			conn = 0;
+		case POINT:
+			sp++;
+			continue;
+		case ENDSYM:
+			break;
+		}
+		break;
+	}
+	return 1;
+}
+
+static double rot[2][2];
+
+static void
+setrot(struct place *p, double s, int r)
+{
+	double x0,y0,x1,y1;
+	struct place up;
+	up = *p;
+	up.nlat.l += .5*RAD;
+	trig(&up.nlat);
+	if(r&&(*projection)(p,&x0,&y0)) {
+		if((*projection)(&up,&x1,&y1)<=0) {
+			up.nlat.l -= RAD;
+			trig(&up.nlat);
+			if((*projection)(&up,&x1,&y1)<=0)
+				goto unit;
+			x1 = x0 - x1;
+			y1 = y0 - y1;
+		} else {
+			x1 -= x0;
+			y1 -= y0;
+		}
+		x1 = r*x1;
+		s /= hypot(x1,y1);
+		rot[0][0] = y1*s;
+		rot[0][1] = x1*s;
+		rot[1][0] = -x1*s;
+		rot[1][1] = y1*s;
+	} else {
+unit:
+		rot[0][0] = rot[1][1] = s;
+		rot[0][1] = rot[1][0] = 0;
+	}
+}
+
+static void
+dorot(struct symb *sp, double *px, double *py)
+{
+	*px = rot[0][0]*sp->x + rot[0][1]*sp->y;
+	*py = rot[1][0]*sp->x + rot[1][1]*sp->y;
+}
diff --git a/src/doug/test.results b/src/doug/test.results
new file mode 100644
index 0000000..ff67446
--- /dev/null
+++ b/src/doug/test.results
@@ -0,0 +1,86 @@
+%!PS
+%Creator: map
+%BoundingBox: 72 252 540 720
+%EndComments
+/co /sethsbcolor load def
+/m /moveto load def
+/s /stroke load def
+/t {gsave newpath 0 0 moveto (X) true charpath flattenpath pathbbox /charht exch def pop pop pop grestore charht 2 div sub moveto show} bind def
+/v /lineto load def
+%EndProlog
+gsave
+/Helvetica findfont 10 scalefont setfont
+1 setlinecap
+1 setlinejoin
+.5 setlinewidth
+newpath
+72 72 m
+%grid 
+s
+0 0 0 co
+s
+0.00 setlinewidth
+[3 6] 0 setdash
+%border 
+s
+0 0 0 co
+s
+0.50 setlinewidth
+[] 0 setdash
+%mapfile ./mapdata/world
+s
+0 0 0 co
+s
+0.50 setlinewidth
+[] 0 setdash
+s
+510.7 506.7 m
+499.2 500.2 v
+488.2 493.2 v
+478.6 491.5 v
+462.7 487.7 v
+456.2 485.5 v
+450.2 479.7 v
+442.8 475.6 v
+434.6 472.0 v
+423.6 476.1 v
+414.7 479.7 v
+406.8 482.1 v
+399.3 483.1 v
+s
+399.3 483.1 m
+395.7 483.6 v
+389.7 484.1 v
+377.2 487.2 v
+364.3 489.6 v
+355.1 492.7 v
+338.1 492.0 v
+319.6 489.6 v
+297.7 486.7 v
+291.7 485.5 v
+288.1 485.8 v
+281.7 484.5 v
+270.6 481.7 v
+260.8 476.6 v
+254.8 474.7 v
+245.6 471.5 v
+237.2 468.2 v
+231.2 466.0 v
+227.6 463.6 v
+217.8 459.5 v
+210.1 454.7 v
+201.7 453.7 v
+s
+201.7 453.7 m
+200.3 453.5 v
+191.6 457.1 v
+173.6 463.6 v
+160.2 467.7 v
+145.3 477.1 v
+133.8 485.5 v
+118.9 499.3 v
+104.7 513.7 v
+s
+540.0 252.0 m
+showpage
+grestore
diff --git a/src/lambert.c b/src/lambert.c
index 7fb3e0d..4fbd31c 100644
--- a/src/lambert.c
+++ b/src/lambert.c
@@ -41,10 +41,17 @@ lambert(double par0, double par1)
 	deg2rad(par1, &stdp1);
 	if(fabs(par1+par0)<.1) 
 		return(mercator());
-	if(fabs(par0)>89.5||fabs(par1)>89.5)
-		return(0);
+	if(fabs(par1)>89.5) {
+		if(par0>89.5)
+			return(map_perspective(-1.));
+		else if(par0<-89.5)
+			return 0;	/* S pole stereographic */
+		else
+			return 0;
+	}
 	if(fabs(par1-par0)<.1)
 	  /* series expansion about stdp1.s = stdp0.s */
+	  /* thanks to Alex Deckmyn for pointing this out */
 	  k = stdp0.s + 0.5*(stdp1.s - stdp0.s);
 	else 
 	  k = 2*log(stdp1.c/stdp0.c)/log(
diff --git a/src/mapproject.c b/src/mapproject.c
index 86e8cf9..345f0b4 100644
--- a/src/mapproject.c
+++ b/src/mapproject.c
@@ -67,7 +67,7 @@ struct index {
 void setproj(name, par, n, o, error)
      char **name, **error;
      double par[], o[];
-     long *n;
+     int *n;
 {
   struct index *i, *theproj = 0;
   static char errbuf[200];
@@ -129,7 +129,7 @@ static int project(lon, lat, x, y)
 
 void doproj(lon, lat, n, range, error)
      double lon[], lat[], range[];
-     long *n, *error;
+     int *n, *error;
 {
   int i, ok;
   double x, y;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-mapproj.git



More information about the debian-science-commits mailing list