diff options
| author | Frank Warmerdam <warmerdam@pobox.com> | 1999-03-18 16:34:52 +0000 |
|---|---|---|
| committer | Frank Warmerdam <warmerdam@pobox.com> | 1999-03-18 16:34:52 +0000 |
| commit | 565a4bd035b9d4a83955808efef20f1d8dfa24cf (patch) | |
| tree | 75785fc897708023f1ccdaf40079afcbaaf0fd3a | |
| download | PROJ-565a4bd035b9d4a83955808efef20f1d8dfa24cf.tar.gz PROJ-565a4bd035b9d4a83955808efef20f1d8dfa24cf.zip | |
New
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@776 4e78687f-474d-0410-85f9-8d5e500ac6b2
161 files changed, 15838 insertions, 0 deletions
diff --git a/CHANGE-LOG b/CHANGE-LOG new file mode 100644 index 00000000..bd8c3d8f --- /dev/null +++ b/CHANGE-LOG @@ -0,0 +1,290 @@ +Rel. 4.1 93/3/8 Base-line --- @(#)CHANGE-LOG 4.14 95/09/23 GIE REL +------------------------------------------------------------------------- +93/3/20 + pj_init -- added +k_0 as alternative to +k so as to match documentation. + +93/3/21 + Laborde projection added. Primarily for Madagascar grid. + Considered BETA at moment until info obtained to give adequate + documentation. + +93/3/26 + Oblique Mercator modified to allow processing of Malasian Grid. + +no_uoff and +rot_conv options added. + +93/3/26 + Corrected text in Interim Report: + p. 12 - +phi's changed to +lat's + p. 12 - added updated Oblique Mercator documentation + +Unresolved: + +Reports of errno 25 persist. Do not know what platform. Reviewed + code and can't see problem. +Unknown platform has problem with pj_errno global and linker storage + allocation. Seems similar to SG problem that was over come with + -common switch. + +Rel. 4.1.1 93/3/26 Base-line +------------------------------------------------------------------------- + +93/4/2 + gen_cheby.c - added <stdio.h> header. + +93/4/3-4 + gen_cheby.c, projects.h - corrected gen_cheby argument declarations + related to 'proj' argument and prototype. Often signalled + warnings, but still managed to execute OK. + + pj_init.c - local function get_init had insufficient storage + defined for copy of file name and id. Added id define. + Strncat replaced with correct strncpy (amazingly did not + cause problems except of one system). + + Proj now compiles on DOS Microsoft 5.0 C compiler. MS suffers + same brain-damage as DEC, so requires local strtod function. + + pj_strerrno prototype added to projects.h + + DOS option in strtod.c for MS C's lack of standard macros in neaders. + +Rel. 4.1.2 93/4/4 Base-line +------------------------------------------------------------------------- + +93/4/8 + Corrected pj_inv so that errno and pj_errno are reset on entry. + +93/4/14 + Added elliptical forms to Azimuthal Equidistant (aeqd). + +93/4/15 + Corrected positive error return to negative in PJ_lcc.c . + + Added Indian units conversions to pj_units. + +Rel. 4.1.3 93/4/15 Base-line +------------------------------------------------------------------------- + +93/5/22 + Extensively revised Chebychev approximation procedures and added + conversion to power series. + +93/6/8 + Changed type of pj_param, plus mods to some other internal procedures. + +93/6/13 + Modified pj_factors. Principle mod was that calling program must + provide base for structure FACTORS. Additional mods reflect + optional analytic input from projection modules (see next entry). + + Modified base of PJ structure for projections to supply analytic + values of partial derivatives, scale factors and/or convergence + when formulary available. + + Added -V option for proj so as to provide more complete, verbose + analysis of projection characteristics at selected geographic or + cartesian point. + +93/6/14 + Pj_errno given its own module and projects.h declares it external. + To cover ANSI standards related to global variable. SG linker should + stop complaining. + +93/7/15 + Several additions and a couple of minor corrections to elliptical + tables. + +93/8/4 + PJ_ocea.c error in applying k0. + +93/8/19 + Minor general corrections. + Added nadcon conversion procedures and nad2nad program. + Projects.h modified to reflect nadcon prototypes and stuctures. + pj_open_lib extracted from pj_init and made global for use in nad_init. + +93/8/25 + Corrected pj_open_lib open for both binary and text modes. Mostly + for brain damaged DOS. Also affected calls in pj_init.c and nad_init.c + + Installs and other scripts updated. + +Rel. 4.2 93/8/25 Base-line +------------------------------------------------------------------------- + +93/9/13 + Improved bch2bps.c code. Old code not in error. + Still problems with DEC native C compiler. + +93/9/28 + Modified install script for DEC entry, forcing gcc for compilation. + +93/9/29 + Problem with due South forward in geod. Current version will not + be fixed as it is to be replaced with Vincente algorithm. + +93/9/30 + Two corrections in src/Makefile. + +Rel. 4.2.1 93/9/30 Base-line +------------------------------------------------------------------------- + +93/10/3 + Geod incorrectly computed some forward values when geodesic on the + merdian. + +93/11/2 + Projection stere fails for polar cases because of 0 lat_ts. Fixed + by testing for lat_ts specification and setting to 90 degrees when + lat_ts not specified. UPS not affected. + +93/11/5 + Inverse polar stereographic also failed on 0 x xor y. Corrected. + +93/11/10 + Changed "install" to include "plain" system type for systems that + do not require special consideration. + +Rel. 4.2.2 93/9/30 Base-line +------------------------------------------------------------------------- + +93/11/14 + 1. Minor change to projects.h to correct prototype. + 2. Changes to pj_init.c regarding ignoring failure to open + proj_def.dat. + 3. Alternate method of initializing automatic array. + +93/11/16 + DOS distribution. + +93/11/28 + Added "Final" figure line to begining of -V option ouput. Allows + user to see results of +ellps and +R_V, etc. arguments. "Feature," + not an error. Mod to proj.c. + +93/12/03 + Removed non-ANSI usage of errno from PJ_laea. + Added test for previous definition of NULL in strtod.c. + +93/12/12 + Made aatan2 (compensates for 0,0 args) global. + +93/12/30 + Removed proj "error" message at end of -l option list. + +94/1 + Major revision to projection structure to facilitate maintenance. + Introduced PROJ_HEAD macro that is defined in several ways + dependent upon use. Allows generation of pj_list table from + `grep'ed projection files. Structure PJ now contains pointer + to const string giving ascii description of projection. Limited + application projection list much easier to generate with this system. + + Many new pseudocylindrical projections added as well as a few new + miscellaneous projections. Total projection count now 110. + +Rel. 4.3 94/2/16 Base-line +------------------------------------------------------------------------- + +94/3/13 + Equidistant Conic forced es to 0, thus previous ellipsoid usage flawed. + + Correction to sign of convergence angle and other details in + pj_factors.c. + + Lambert Conf. conic corrected for +lat_0=90. + + Convergence sign in pj_factors.c corrected to conform to Bomford's + definition. Also procedure corrected for usage when projection + returns some of its own factors. + +94/3/17 + Added procedure pj_phi12 to support library. It gets and checks + standard parallels for some of the conics. + + Added SPECIAL entry to conics Lambert, Albers and Equidistant. + + Corrected nad/install.in test so as to only look for conus.lla.Z + as test for installation of NADCON datum matricies. + +94/3/19 + Problems with MAPGEN's mapdef choking on call to proj. Fixed + with PROJ.4.3-patch-01. + +94/3/22 + Bumb mode of handling memory allocation for 2D arrays, so that + execution of -L may not work on some systems. Interim corrections + distributed with PROJ.4.3-patch-02. + + Patched Make.2 to properly use $(LIBS). Not in patch. + + Apple's Unix libc has problems---no strerror and no %n in ?format. + +94/5/22 + Added several simple conics but not totally verified. + + Corrected proj.c so that resultant earth figure comments in -V + are prefixed with # and do not blow *mapdef*. + + Releasing current code without documentation on new conics pending + communications with Snyder on their veracity. Release mainly to + clean up patches. + +Rel. 4.3.1 94/2/16 Base-line +------------------------------------------------------------------------- + +94/6/2 + Transverse Mercator, spherical inverse fixed. Misplaced parenthsis. + +94/10/5 + Dropped dependency on FILENAME_MAX---too poorly defined in both + POSIX and ANSI standards. Adopted MAX_PATH_FILENAME which is + set to 1024 (should be enough for most cases). This should solve + problem with HP installations. + +94/10/29 + Problems with ellipsoidal for of azimuthal equidistant (PJ_aeqd.c). + Some discrepancies remain on comparison with Snyder's examples + but felt due to his use of TI calculator. Procedure should be + replaced with better geodesic routine. + +94/10/29 + Corrected and added examples to geod.1 documentation. + +94/10/30 + Added mkdir in nad/install otherwise nad2783 install may fail. + +Rel. 4.3.2 94/10/30 Base-line +------------------------------------------------------------------------- + +95/4/27 + Corrected rf factor for GRS67. + Thanks to: Peter Shih tyshih@cc.nctu.edu.tw + +95/6/3 + Gave an initializing value for pj_errno. Someone's compiler ignored + the whole module because nothing happened(!!!). + Thanks to: Mark Crispin <MRC@Panda.COM>. + +95/7/6 + Corrected function pj_inv_mlfn for improper derivative code. + Previous computations not in error but convergence was slower. + Thanks to: Tony Fisher fisher@minster.york.ac.uk. + +95/8/8 + Added Swiss Oblique Mercator projection. CH1903 Swiss grid system + parameters added to nad/world. <CH1903> added to nad/world file + and N-somerc.ps.Z added to documentation notes. + Thanks to: Daniel Ebneter, ebneter@iap.unibe.ch. + +95/9/5 + Changed declaration of "char c" to "int c" to more properly monitor + error return value in pj_init.c. + Thanks to: Alejo Hausner (ah@cs.princeton.edu) + +95/9/10 + Some minor file/internal name changes to facilitate xport to primative + systems. Documented entries unchanged. + +Rel. 4.3.4 95/9/23 Base-line +------------------------------------------------------------------------- @@ -0,0 +1,107 @@ + -------------------- P R O J . 4 -------------------- + @(#)README 4.11 95/09/24 GIE REL" + +This is Release 4.3 of cartographic projection software. + +PLEASE read the following information as well as READMEs in the src +and nad directories. + +PLEASE send information on any problems encountered or general inquiries to + + gie@kai.er.usgs.gov + +or call Gerald I. Evenden at (508)563-6766 or write to same at: + + P.O. Box 1027 + N. Falmouth, MA 02556-1027 + USA + + --------------------------------------------------- + +Installation: +------------- + +FSF's configuration procedure is used to ease installation of the +PROJ.4 system. + +The default destination path prefix for installed files is /usr/local. +Results from the installation script will be placed into subdirectories +bin, include, lib, man/man1 and man/man3. If this default path prefix +is proper, then execute: + + ./configure + +If another path prefix is required, then execute: + + ./configure --prefix=/my/path + +In either case, the directory of the prefix path must exist and be +writable by the installer. + +After executing configure, execute: + + sh install + +The install script will create, if necessary, all required sub- +directories. + + --------------------------------------------------- + +Distribution files and format. +------------------------------ + +Sources are distributed in one or more files. The principle elements +of the system are in a compress tar file named `PROJ.4.x.tar.gz' where +"x" will indicate level.sub-level of the release. For U.S. users +interested in NADCON datum shifting procedures, additional files +containing conversion matricies are distributed with the name +`PROJ.4.x.y.tar' where y is an uppercase letter starting with "A." +These supplementary files will contain compressed files and thus +the tar file is not compressed. + +Interim reports on Rel. 4 proj are available in PostScript form as +*.ps.gz . New and old users are strongly recommended to carefully read +these manuals. They are supplements and NOT a replacement for the full +manual OF 90-284 (which new users should also obtain). + + --------------------------------------------------- + +Principle new aspects of system: +-------------------------------- + +ANSI X3.159-1989 C code. Site must have ANSI C compiler and header files. + +Several method of determining radius from specified ellipsoid. + +Use of initialization files through +init=file:key. Default projection +specifications also may be defined in an ASCII file. + ++inv option REMOVED and -I may be used in its place. Use of invproj +alias of proj still functions as per Rel.3. + ++ellps=list and +proj=list REMOVED. Use respective -le and -lp. + ++units= to specify cartesian coordinate system units. To get list +use -lu. + +-v added to dump final cartographic parameters employed. + +Addition of computing scale factors and angular distortion added through +-S option. Valuable for designing new projection parameter details. + +-V option which verbosely lists projected point characteristics. + +Programmers may use projection library with calls to pj_init and +pj_fwd and/or pj_inv. + +Program nad2nad for conversion of data to and from NAD27 and NAD83 +datums. + +------------------------------------------------------------- + +Things currently left undone: +---------------------------- + +proj_def.dat NOT fully in place. Needs additional settings for +many of the projections. Probably will not be completed until main +manual rewritten. diff --git a/configure b/configure new file mode 100755 index 00000000..e4a18013 --- /dev/null +++ b/configure @@ -0,0 +1,383 @@ +#!/bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf. +# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] +# [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]] +# Ignores all args except --srcdir, --prefix, --exec-prefix, and +# --with-PACKAGE[=VALUE] unless this script has special code to handle it. + +for arg +do + # Handle --exec-prefix with a space before the argument. + if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix= + # Handle --host with a space before the argument. + elif test x$next_host = xyes; then next_host= + # Handle --prefix with a space before the argument. + elif test x$next_prefix = xyes; then prefix=$arg; next_prefix= + # Handle --srcdir with a space before the argument. + elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir= + else + case $arg in + # For backward compatibility, recognize -exec-prefix and --exec_prefix. + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*) + exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e) + next_exec_prefix=yes ;; + + -gas | --gas | --ga | --g) ;; + + -host=* | --host=* | --hos=* | --ho=* | --h=*) ;; + -host | --host | --hos | --ho | --h) + next_host=yes ;; + + -nfp | --nfp | --nf) ;; + + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + next_prefix=yes ;; + + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*) + srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s) + next_srcdir=yes ;; + + -with-* | --with-*) + package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that aren't valid shell variable names. + if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then + echo "configure: $package: invalid package name" >&2; exit 1 + fi + package=`echo $package| sed 's/-/_/g'` + case "$arg" in + *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;; + *) val=1 ;; + esac + eval "with_$package='$val'" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v) + verbose=yes ;; + + *) ;; + esac + fi +done + +trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15 +trap 'rm -f confdefs*' 0 + +# NLS nuisances. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi + +rm -f conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h +compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1' + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +unique_file=install.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + srcdirdefaulted=yes + # Try the directory containing this script, then `..'. + prog=$0 + confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` + test "X$confdir" = "X$prog" && confdir=. + srcdir=$confdir + if test ! -r $srcdir/$unique_file; then + srcdir=.. + fi +fi +if test ! -r $srcdir/$unique_file; then + if test x$srcdirdefaulted = xyes; then + echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2 + else + echo "configure: Can not find sources in \`${srcdir}'." 1>&2 + fi + exit 1 +fi +# Preserve a srcdir of `.' to avoid automounter screwups with pwd. +# But we can't avoid them for `..', to make subdirectories work. +case $srcdir in + .|/*|~*) ;; + *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. +esac + + +# Save the original args to write them into config.status later. +configure_args="$*" + +PROGS="libproj proj geod nad2nad nad2bin" +LIB_DIR="proj.4" +if test -z "$RANLIB"; then + # Extract the first word of `ranlib', so it can be a program name with args. + set dummy ranlib; word=$2 + echo checking for $word + IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/$word; then + RANLIB="ranlib" + break + fi + done + IFS="$saveifs" +fi +test -z "$RANLIB" && RANLIB=":" +test -n "$RANLIB" && test -n "$verbose" && echo " setting RANLIB to $RANLIB" + +if test -z "$CC"; then + # Extract the first word of `gcc', so it can be a program name with args. + set dummy gcc; word=$2 + echo checking for $word + IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/$word; then + CC="gcc" + break + fi + done + IFS="$saveifs" +fi +test -z "$CC" && CC="cc" +test -n "$CC" && test -n "$verbose" && echo " setting CC to $CC" + +# Find out if we are using GNU C, under whatever name. +cat > conftest.c <<EOF +#ifdef __GNUC__ + yes +#endif +EOF +${CC-cc} -E conftest.c > conftest.out 2>&1 +if egrep yes conftest.out >/dev/null 2>&1; then + GCC=1 # For later tests. +fi +rm -f conftest* + +for func in strerror +do +trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'` +echo checking for ${func} +cat > conftest.c <<EOF +#include "confdefs.h" +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_${func}) || defined (__stub___${func}) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char ${func}(); ${func}(); +#endif + } +EOF +if eval $compile; then + rm -rf conftest* + { +test -n "$verbose" && \ +echo " defining ${trfunc}" +echo "#define" ${trfunc} 1 >> confdefs.h +DEFS="$DEFS -D${trfunc}=1" +} + + +fi +rm -f conftest* +done + +LIBS_save="${LIBS}" +LIBS="${LIBS} -lm" +have_lib="" +echo checking for -lm +cat > conftest.c <<EOF +#include "confdefs.h" + +int main() { exit(0); } +int t() { main(); } +EOF +if eval $compile; then + rm -rf conftest* + have_lib="1" + +fi +rm -f conftest* +LIBS="${LIBS_save}" +if test -n "${have_lib}"; then + +{ +test -n "$verbose" && \ +echo " defining HAVE_LIBM" +echo "#define" HAVE_LIBM 1 >> confdefs.h +DEFS="$DEFS -DHAVE_LIBM=1" +} + + LIBS="${LIBS} -lm" +fi + +for func in hypot +do +echo checking for ${func} +cat > conftest.c <<EOF +#include "confdefs.h" +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_${func}) || defined (__stub___${func}) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char ${func}(); ${func}(); +#endif + } +EOF +if eval $compile; then + : +else + rm -rf conftest* + LIBOBJS="$LIBOBJS ${func}.o" +test -n "$verbose" && echo " using ${func}.o instead" +fi +rm -f conftest* + +done + +if `test -n "$LIBOBJS"` ; then +PJ_ADDL="\$L($LIBOBJS)" +fi +cat > conftest.c <<EOF +#include "confdefs.h" +#include <stdlib.h> +main() { + double t; char *s; + + t = strtod("2.0D5", &s); + exit (!(t == 2. && *s == 'D')); +} +EOF +eval $compile +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + PJ_ADDL="$PJ_ADDL \$L(strtod.o)" +fi +rm -fr conftest* +# Set default prefixes. +if test -n "$prefix"; then + test -z "$exec_prefix" && exec_prefix='${prefix}' + prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" +fi +if test -n "$exec_prefix"; then + prsub="$prsub +s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" +fi +# Quote sed substitution magic chars in DEFS. +cat >conftest.def <<EOF +$DEFS +EOF +escape_ampersand_and_backslash='s%[&\\]%\\&%g' +DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def` +rm -f conftest.def +# Substitute for predefined variables. + +trap 'rm -f config.status; exit 1' 1 3 15 +echo creating config.status +rm -f config.status +cat > config.status <<EOF +#!/bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $configure_args + +for arg +do + case "\$arg" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args + exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;; + *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; + esac +done + +trap 'rm -f install src/Makefile nad/install; exit 1' 1 3 15 +PROGS='$PROGS' +LIB_DIR='$LIB_DIR' +RANLIB='$RANLIB' +CC='$CC' +PJ_ADDL='$PJ_ADDL' +LIBOBJS='$LIBOBJS' +LIBS='$LIBS' +srcdir='$srcdir' +DEFS='$DEFS' +prefix='$prefix' +exec_prefix='$exec_prefix' +prsub='$prsub' +extrasub='$extrasub' +EOF +cat >> config.status <<\EOF + +top_srcdir=$srcdir + +CONFIG_FILES=${CONFIG_FILES-"install src/Makefile nad/install"} +for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then + srcdir=$top_srcdir + # Remove last slash and all that follows it. Not all systems have dirname. + dir=`echo $file|sed 's%/[^/][^/]*$%%'` + if test "$dir" != "$file"; then + test "$top_srcdir" != . && srcdir=$top_srcdir/$dir + test ! -d $dir && mkdir $dir + fi + echo creating $file + rm -f $file + echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file + sed -e " +$prsub +$extrasub +s%@PROGS@%$PROGS%g +s%@LIB_DIR@%$LIB_DIR%g +s%@RANLIB@%$RANLIB%g +s%@CC@%$CC%g +s%@PJ_ADDL@%$PJ_ADDL%g +s%@LIBOBJS@%$LIBOBJS%g +s%@LIBS@%$LIBS%g +s%@srcdir@%$srcdir%g +s%@DEFS@%$DEFS% +" $top_srcdir/${file}.in >> $file +fi; done + + +exit 0 +EOF +chmod +x config.status +${CONFIG_SHELL-/bin/sh} config.status + diff --git a/install.in b/install.in new file mode 100755 index 00000000..7838131a --- /dev/null +++ b/install.in @@ -0,0 +1,47 @@ +: +# First time install script +# @(#)install.in 4.3 94/05/22 GIE REL" +prefix=/usr/local +if [ ! -w $prefix ] ; then + echo "$prefix must exist and be writable" + exit 1 +fi +# check if destination directories available and if not make +for x in bin lib lib/proj.4 include man man/man1 man/man3 +do + if [ ! -d ${prefix}/$x ] ; then + mkdir ${prefix}/$x + if [ $? -ne 0 ] ; then + echo "failed to make directory ${prefix}/$x" + echo "install stopped" + exit 1 + fi + fi +done +# proceed to make software +cd src +make install +if [ $? -ne 0 ] ; then + echo "make failed, install stopped" + exit 1 +fi +# install man files +cd ../man/man1 +echo "installing man.1 files" +for x in * +do + cp $x ${prefix}/man/man1/$x +done +cd ../man3 +echo "installing man.3 files" +for x in * +do + cp $x ${prefix}/man/man3/$x +done +# install reference files +cd ../../nad +sh install +if [ $? -ne 0 ] ; then + echo "Installation of proj system complete" +fi +exit 0 diff --git a/man/man1/geod.1 b/man/man1/geod.1 new file mode 100644 index 00000000..36f32717 --- /dev/null +++ b/man/man1/geod.1 @@ -0,0 +1,202 @@ +.\" @(#)geod.1 - 1.1 +.nr LL 5.5i +.ad b +.hy 1 +.TH GEOD 1 "94/10/29 Rel. 4, Ver. BETA" "GIE" +.SH NAME +geod \- direct geodesic computations +.br +invgeod \- inverse geodesic computations +.SH SYNOPSIS +.B geod +[ +.B \-afFIlptwW +[ +.I args +] ] [ +.B +args +] +file[s] +.br +.B invgeod +[ +.B \-afFIlptwW +[ +.I args +] ] [ +.B +args +] +file[s] +.SH DESCRIPTION +.I Geod +(direct) and +.I invgeod +(inverse) +perform geodesic (\(``Great Circle\('') computations for determining +latitude, longitude and back azimuth of a terminus point +given a initial point latitude, longitude, azimuth and distance (direct) or +the forward and back azimuths and distance between an initial and +terminus point latitudes and longitudes (inverse). +.PP +The following runline control parameters can appear in any order: +.TP +.B \-I +Specifies that the inverse geodesic computation is to be performed. +May be used with execution of +.B goed +as an alternative to +.B invgeod +execution. +.TP +.B \-a +Latitude and longitudes of the initial and terminal points, +forward and back azimuths and distance are output. +.TP +.BI \-t "a" +.I A +specifies a character employed as the first character to denote +a control line to be passed through without processing. +.TP +.BI \-le +Gives a listing of all the ellipsoids that may be selected with the +.B +ellps= +option. +.TP +.BI \-lu +Gives a listing of all the units that may be selected with the +.B +units= +option. +.TP +.BI \-[f|F] " format" +.I Format +is a +.I printf +format string to control the output form of the geographic coordinate values +(\fBf\fR) or distance value (\fBF\fR). +The default mode is DMS for geographic coordinates and "%.3f" for distance. +.TP +.BI \-[w|W] n +.I N +is the number of significant fractional digits to employ for +seconds output (when the option is not specified, +.B \-w3 +is assumed). +When +.B \-W +is employed the fields will be constant width with leading zeroes. +.TP +.B \-p +This option causes the azimuthal values to be output as unsigned +numbers between 0 and 360\(de. +.PP +The +.B +args +run-line arguments are associated with geodetic parameters +for specifying the ellipsoidal or sphere to use. +See +.B proj +documentation for full list of these parameters and contrl. +The options are processed in left to right order +from the run line. +Reentry of an option is ignored with the first occurance assumed to +be the desired value. +.PP +One or more +.I files +(processed in left to right order) +specify the source of data to be transformed. +A \- will specify the location of processing standard input. +If no files are specified, the input is assumed to be from +.I stdin. +.PP +For direct determinations input data must be in latitude, +longitude, azimuth and distance order and output will be +latitude, longitude and back azimuth of the terminus point. +Latitude, longitude of the initial and terminus point are +input for the inverse mode and respective forward and back +azimuth from the initial and terminus points are output along +with the distance between the points. +.PP +Input geographic coordinates +(latitude and longitude) and azimuthal data must be in DMS format and input +distance data must be in units consistent with the ellipsoid +major axis or sphere radius units. +Output geographic coordinates will be in DMS +(if the +.B \-f +switch is not employed) to 0.001" +with trailing, zero-valued minute-second fields deleted. +Output distance data will be in the same units as the ellipsoid or +sphere radius. +.PP +The Earth's ellipsoidal figure may be selected in the same +manner as program +.B proj +by using +.B "+ellps=, +a=, +es=," +etc. +.PP +.I Geod +may also be used to determine intermediate points along either +a geodesic line between two points or along an arc of specified distance +from a geographic point. +In both cases an initial point must be specified with +.BI +lat_1= lat +and +.BI +lon_1= lon +parameters and either a terminus point +.BI +lat_2= lat +and +.BI +lon_2= lon +or a distance and azimuth from the initial point with +.BI +S= distance +and +.BI +A= azimuth +must be specified. +.PP +If points along a geodesic are to be determined then either +.BI +n_S= integer +specifying the number of intermediate points and/or +.BI +del_S= distance +specifying the incremental distance between points must be specified. +.PP +To determine points along an arc equidistant from the initial point both +.BI +del_A= angle +and +.BI +n_A= integer +must be specified which determine the respective angular increments +and number of points to be determined. +.RE +.SH EXAMPLE +The following script determines the geodesic azimuths and distance in +U.S. stature miles from Boston, MA, to Portland, OR: +.RS 5 + \f(CWgeod +ellps=clrk66 <<EOF -I +units=us-mi + 42d15'N 71d07'W 45d31'N 123d41'W + EOF\fR +.RE +which gives the results: +.RS 5 + \f(CW-66d31'50.141" 75d39'13.083" 2587.504 +.RE +where the first two values are the +azimuth from Boston to Portland, the back azimuth from Portland to +Boston followed by the distance. +.PP +An example of forward geodesic use is to use the Boston location and determine +Portland's location by azimuth and distance: +.RS 5 + \f(CWgeod +ellps=clrk66 <<EOF +units=us-mi + 42d15'N 71d07'W -66d31'50.141" 2587.504 + EOF\fR +.RE +which gives: +.RS 5 + \f(CW45d31'0.003"N 123d40'59.985"W 75d39'13.094"\fR +.RE +Note: lack of precision in the distance value compromises +the precision of the Portland location. +.SH SEE ALSO +Thomas, P.D., 1970, +.I "Spheroidal Geodesics, Reference Systems & Local Geometry:" +U.S. Naval Oceanographic Office, S-138. diff --git a/man/man1/nad2nad.1 b/man/man1/nad2nad.1 new file mode 100644 index 00000000..ebc4562a --- /dev/null +++ b/man/man1/nad2nad.1 @@ -0,0 +1,187 @@ +.\" release 4 +.nr LL 5.5i +.ad b +.hy 1 +.TH PROJ 1 "93/08/25 Rel. 1, Ver. REL" "GIE" +.SH NAME +nad2nad \- North American Datum conversion filter +.SH SYNOPSIS +.B nad2nad +[ +.B \-eEfihortwW +[ +.I args +] ] [ +.B +args +] +file[s] +.SH DESCRIPTION +Program +.B nad2nad +is a filter to convert data between North +America Datum 1927 (NAD27) and North American Datum 1983. +.B nad2nad +can optionally process both State Plane Coordinate System (SPCS) and +Universal Transverse Mercator (UTM) grid data as well +as geographic data for both input and output. +.PP +The following control parameters can appear in any order: +.TP +.BI \-[i|o] " keyword[,keyword]" +The +.B \-i +and +.B \-o +option expect keyword arguments which define various characteristics and +processing modes of the +respective input data. +Usage allows multiple arguments to be included with a \- operator +when separated by commas. +Datum conversion requires the data to be in geographic coordinates, but +.B nad2nad +will allow conversion of data to and from SPCS or UTM grid systems. +The following are keywords and arguments reconized by both the +.B \-i +and +.B \-o +that will apply to respective input and output conversion of user +data to internal geographic coordinates: +.RS 1in +.TP +.B 27|83 +datum of data +.TP +.BI utm= n +.B UTM +coordinates in meters for zone +.I n +.TP +.BI spcs= n +for data in +.B SPCS +coordinates, where +.I n +is state zone number. +.TP +.B feet +data units are in U.S. Surveyor's feet. +This is allowed only when the +.I spcs +option been previously used. +Default coordinates are in meters. +.TP +.B bin +for data in binary form. +.TP +.B rev +data in lat-lon order rather than default lon-lat order. +.TP +.BI hp= ss +use high precision conversion zone +.I ss. +Certain States have ancillary correction tables to further refine +the basic conus table. +.I Ss +key and States are: +.RS .5in +FL Florida +.br +MD Maryland +.br +TN Tennessee +.br +WI Wisconsin +.br +WO Washington, Oregon and northern part of California. +.RE +.RE +.TP +.BI \-t "a" +.I A +specifies a character employed as the first character to denote +a control line to be passed through without processing. +This option applicable to ascii input only. +(# is the default value). +.TP +.BI \-e " string" +.I String +is an arbitrary string to be output if an error is detected during +data transformations. +The default value is: *\et*. +Note that if the +.B "\-o bin" +option is employed, an error is output as HUGE_VAL for both values. +.TP +.BI \-r " region" +specifies which regional conversion table to employ which are identified +by the following: +.RS .5in +conus \- conterminous 48 States +.br +alaska \- State of Alaska +.br +hawaii \- State of Hawaii +.br +prvi \- Puerto Rico and Virgin Islands +.br +stgeorge \- St. George Is, Alaska +.br +stpaul \- St. Paul Is, Alaska +.br +stlrnc \- St. Lawrence Is, Alaska +.TP +.B \-E +Input coordinates are echoed to output before ouput values. +.RE +.TP +.BI \-f " format" +.I Format +is a +.I printf +format string to control the form of the output values. +For inverse projections, the output will be in degrees when this option +is employed. +If a format is specified for inverse projection the +output data will be in decimal degrees. +The default format is \(``%.2f\('' for forward projection and DMS +for inverse. +.TP +.BI \-[w|W] n +.I N +is the number of significant fractional digits to employ for +seconds output (when the option is not specified, +.B \-w3 +is assumed). +When +.B \-W +is employed the fields will be constant width and with leading zeroes. +.PP +One or more +.I files +(processed in left to right order) +specify the source of data to be transformed. +A \- will specify the location of processing standard input. +If no files are specified, the input is assumed to be from +.I stdin. +For ASCII input data the two data values must be in the +first two white space separated fields and +when both input and output are ASCII all trailing portions +of the input line are appended to the output line. +.PP +Input geographic data +(longitude and latitude) must be in DMS format when neither +.I utm +nor +.I spcs +is specified, otherwise in meters or feet (\fIfeet\fR option used). +Input data fields must be separated by white space and not have +imbedded white space. +.PP +Output data will be in tab separated fields of DMS or grid +coordinates in meters or feet. +.PP +Any data after the two input values are echoed after the two +output data values. +.SH SEE ALSO +.I "Cartographic Projection Procedures for the UNIX Environment\(emA User's Manual," +(Evenden, 1990, Open-file report 90\-284). diff --git a/man/man1/proj.1 b/man/man1/proj.1 new file mode 100644 index 00000000..a335d55a --- /dev/null +++ b/man/man1/proj.1 @@ -0,0 +1,283 @@ +.\" release 4 +.nr LL 5.5i +.ad b +.hy 1 +.TH PROJ 1 "94/01/29 Rel. 4, Ver. BETA" "GIE" +.SH NAME +proj \- forward cartographic projection filter +.br +invproj \- inverse cartographic projection filter +.SH SYNOPSIS +.B proj +[ +.B \-bceEfiIlmorsStTvVwW +[ +.I args +] ] [ +.B +args +] +file[s] +.br +.B invproj +[ +.B \-bceEfiIlmorsStTwW +[ +.I args +] ] [ +.B +args +] +file[s] +.SH DESCRIPTION +.I Proj +and +.I invproj +perform respective forward and inverse transformation of cartographic data +to or from cartesian data with a wide range of selectable projection functions. +.PP +The following control parameters can appear in any order: +.TP +.BI \-b +Special option for binary coordinate data input and output +through standard input and standard output. +Data is assumed to be in system type +.I double +floating point words. +This option is to be used when +.B proj +is a +.I son +process and allows bypassing formatting operations. +.TP +.BI \-i +Selects binary input only (see +.B \-b option). +.TP +.BI \-I +alternate method to specify inverse projection. +Redundant when used with +.B invproj. +.TP +.BI \-o +Selects binary output only (see +.B \-b option). +.TP +.BI \-t "a" +.I A +specifies a character employed as the first character to denote +a control line to be passed through without processing. +This option applicable to ascii input only. +(# is the default value). +.TP +.BI \-e " string" +.I String +is an arbitrary string to be output if an error is detected during +data transformations. +The default value is: *\et*. +Note that if the +.B \-b, +.B \-i +or +.B \-o +options are employed, an error is returned as HUGE_VAL +value for both return values. +.TP +.BI \-E +causes the input coordinates to be copied to the output line +prior to printing the converted values. +.TP +.BI \-l "[p|P|=|e|u]" id +List projection identifiers with +.B \-l, +.B \-lp +or +.B \-lP (expanded) +that can be selected with +.B +proj. +.BI \-l= id +gives expanded description of projection +.I id. +List ellipsoid identifiers with +.B \-le, +that can be selected with +.B +ellps +or +.B \-lu +list of cartesian to meter conversion factors +that can be selected with +.B +units. +.TP +.BI \-r +This options reverses the order of the +expected input from longitude-latitude or x-y to latitude-longitude or y-x. +.TP +.BI \-s +This options reverses the order of the +output from x-y or longitude-latitude to y-x or latitude-longitude. +.TP +.BI \-S +Causes estimation of +.I meridinal +and +.I parallel +scale factors, +.I area +scale factor and +.I angular distortion, +and +.I maximum +and +.I minimum +scale factors to be listed between <> for each input point. +For conformal projections meridinal and parallel scales factors +will be equal and angular distortion zero. +Equal area projections will have an area factor of 1. +.TP +.BI \-m " mult" +The cartesian data may be scaled by the +.I mult +parameter. +When processing data in a forward projection mode the +cartesian output values are multiplied by +.I mult +otherwise the input cartesian values are divided by +.I mult +before inverse projection. +If the first two characters of +.I mult +are 1/ or 1: then the reciprocal value of +.I mult +is employed. +.TP +.BI \-f " format" +.I Format +is a +.I printf +format string to control the form of the output values. +For inverse projections, the output will be in degrees when this option +is employed. +If a format is specified for inverse projection the +output data will be in decimal degrees. +The default format is \(``%.2f\('' for forward projection and DMS +for inverse. +.TP +.BI \-[w|W] n +.I N +is the number of significant fractional digits to employ for +seconds output (when the option is not specified, +.B \-w3 +is assumed). +When +.B \-W +is employed the fields will be constant width and with leading zeroes. +.TP +.B \-v +causes a listing of cartographic control parameters tested for and +used by the program to be printed prior to input data. +Should not be used with the +.B \-T +option. +.TP +.B \-V +This option causes an expanded annotated listing of the characteristics +of the projected point. +.B -v is implied with this option. +.TP +.BI \-T " ulow,uhi,vlow,vhi,res[,umax,vmax]" +This option creates a set of bivariate Chebyshev polynomial +coefficients that approximate the selected cartographic projection on +.I stdout. +The values +.I low +and +.I hi +denote the range of the input where the +.I u +or +.I v +prefixes apply to respective longitude-x or latitude-y +depending upon whether a forward or inverse projection is selected. +.I Res +is an integer number specifying the power of 10 precision of the +approximation. +For example, a +.I res +of -3 specifies an approximation with an accuracy better than .001. +.I Umax, +and +.I vmax +specify maximum degree of the polynomials (default: 15). +See also: +.B fproj(1). +.PP +The +.B +args +run-line arguments are associated with cartographic parameters +and usage varies with projection and for a complete description see +.I "Cartographic Projection Procedures for the UNIX Environment\(emA User's Manual" ) +and supplementary documentation for Release 4. +.PP +Additional projection control parameters may be contained in two +auxilliary control files: +the first is optionally referenced with the +.BI +init= file:id +and the second is always processed after the name +of the projection has been established from either the run-line +or the contents of +.B +init +file. +The environment parameter +.B PROJ_LIB +establishes the default directory for a file reference without +an absolute path. +.PP +One or more +.I files +(processed in left to right order) +specify the source of data to be transformed. +A \- will specify the location of processing standard input. +If no files are specified, the input is assumed to be from +.I stdin. +For ASCII input data the two data values must be in the +first two white space separated fields and +when both input and output are ASCII all trailing portions +of the input line are appended to the output line. +.PP +Input geographic data +(longitude and latitude) must be in DMS format and input +cartesian data must be in units consistent with the ellipsoid +major axis or sphere radius units. +Output geographic coordinates will be in DMS +(if the +.B \-w +switch is not employed) and precise to 0.001" +with trailing, zero-valued minute-second fields deleted. +.SH EXAMPLE +The following script +.RS 5 + \f(CWproj +proj=utm +lon_0=112w -r <<EOF + 45d15'33.1" 111.5W + 45d15.551666667N -111d30 + +45.25919444444 111d30'000w + EOF\fR +.RE +will perform UTM forward projection with a standard UTM +central meridian nearest longitude 112\(deW. +The geographic values of this example are equivalent and meant +as examples of various forms of DMS input. +The x\-y output data will appear as three lines of: +.RS 5 + \f(CW460769.27 5011648.45 +.RE +.SH SEE ALSO +.I "Cartographic Projection Procedures for the UNIX Environment\(emA User's Manual," +(Evenden, 1990, Open-file report 90\-284). +.br +.I "Map Projections Used by the U. S. Geological Survey" +(Snyder, 1984, +USGS Bulletin 1532). +.br +.I "Map Projections\(emA Working Manual" +(Synder, 1988, USGS Prof. Paper 1395). +.br +.I "An Album of Map Projections" +(Snyder & Voxland, 1989, USGS Prof. Paper 1453). diff --git a/man/man3/pj_init.3 b/man/man3/pj_init.3 new file mode 100644 index 00000000..d6d8e952 --- /dev/null +++ b/man/man3/pj_init.3 @@ -0,0 +1,85 @@ +.\" @(#)pj_init.3 - 4.1 +.nr LL 5.5i +.TH PJ_INIT 3U "92/11/08 Rel. 4, Ver. BETA" "GIE" +.ad b +.hy 1 +.SH NAME +pj_init \- initialize cartographic projection +.br +pj_fwd \- forward cartographic projection +.br +pj_inv \- inverse cartographic projection +.br +pj_free \- de-initialize projection +.SH SYNOPSIS +.nf +#include <projects.h> + +PJ *pj_init(int argc, char **argv) + +UV pj_fwd(UV val, PJ *proj) + +UV pj_inv(UV val, PJ *proj) + +void pj_free(PJ *proj) + +.SH DESCRIPTION +Procedure \fBpj_init\fR selects and initializes a cartographic projection +with its argument control parameters. +\fBArgc\fR is the number of elements in the array of control strings +\fBargv\fR that each contain individual cartographic control keyword +assignments (\f(CW+\fR \fBproj\fR arguments). +The list must contain at least the \fBproj=\fIprojection\fR and +Earth's radius or elliptical parameters. +If the initialization of the projection is successful a valid +address is returned otherwise a NULL value. + +Once initialization is performed either forward or inverse +projections can be performed with the returned value of \fBpj_init\fR +used as the argument \fBproj\fR. +The argument structure \fBUV\fR values \fBu\fR and \fBv\fR contain +respective longitude and latitude or x and y. +Latitude and longitude are in radians. +If a projection operation fails, both elements of \fBUV\fR are +set to HUGE_VAL (defined in \fImath.h\fR). + +\fBNote:\fR all projections have a forward mode, but some do not have +an inverse projection. +If the projection does not have an inverse the PJ structure element +\fIinv\fR will be NULL. + +Memory associated with the projection may be freed with \fBpj_free\fR. +.SH EXAMPLE +The following program reads latitude and longitude values in decimal +degress, performs Mercator projection with a Clarke 1866 ellipsoid and +a 33\(de latitude of true scale and prints the projected +cartesian values in meters: +.nf +\f(CW +#include <projects.h> +main(int argc, char **argv) { + char *args[] = { "proj=merc", "ellps=clrk66", "lat_ts=33" }; + UV p; + PJ *pj; + + if (!(pj = pj_init(3, args))) + exit(1); + while (scanf("%lf %lf", &p.v, &p.u) == 2) { + p.u *= DEG_TO_RAD; + p.v *= DEG_TO_RAD; + p = pj_fwd(p, pj); + printf("%.2f\et%.2f\en", p.u, p.v); + } + exit(0); +} \fR +.br +.fi +.SH LIBRARY +libpj.a \- library of projections and support procedures +.SH SEE ALSO +.B proj(1U), +.br +.I "Cartographic Projection Procedures for the UNIX Environment\(emA User's Manual," +(Evenden, 1990, Open-file report 90\-284). +.SH AUTHOR/MAINTENANCE +Gerald I. Evenden, USGS, Woods Hole, MA 02543 diff --git a/nad/GL27 b/nad/GL27 new file mode 100644 index 00000000..dd927bd2 --- /dev/null +++ b/nad/GL27 @@ -0,0 +1,22 @@ +# SCCSID @(#)GL27 1.1 93/08/25 GIE REL +# Great Lakes Grids +<erie-etal> # Lake Erie, Ontario and St. Lawrence River. + proj=omerc ellps=clrk66 k_0=0.9999 + lonc=78d00'W lat_0=44d00'N alpha=55d40' + x_0=-3950000 y_0=-3430000 + no_defs <> +<huron> # Lake Huron + proj=omerc ellps=clrk66 k_0=0.9999 + lonc=82d00'W lat_0=43d00'N alpha=350d37' + x_0=1200000 y_0=-3500000 + no_defs <> +<michigan> # Lake Michigan + proj=omerc ellps=clrk66 k_0=0.9999 + lonc=87d00'W lat_0=44d00'N alpha=15d00' + x_0=-1000000 y_0=-4300000 + no_defs <> +<superior> # Lake Superior, Lake of the Woods + proj=omerc ellps=clrk66 k_0=0.9999 + lonc=88d50'0.256"W lat_0=47d12'21.554"N alpha=285d41'42.593" + x_0=9000000 y_0=-1600000 + no_defs <> diff --git a/nad/README b/nad/README new file mode 100644 index 00000000..aa1745f9 --- /dev/null +++ b/nad/README @@ -0,0 +1,56 @@ + @(#)README 4.4 93/09/26 GIE REL" + +The files in this directory are support data for PROJ.4 programs +as well as test scripts for testing proj installation. + +File Contents: + +README --- This file + +proj_def.dat --- basic default file used by proj. + +nad27 --- North American Datum 1927 for "init=" definition of + State Plane Coordinate Systems (SPCS). + +nad83 --- North American Datum 1983 for "init=" definition of SPCS. + +GL27 --- Great Lakes Survey grids, NAD27 + +world --- Proj specifications for several international grid systems. + +nad.lst --- Reference list of SPCS States and NGS datum identifiers + +nad2bin.c --- C program to convert above ASCII files into binary + files usable by program nad2nad. Compiled and used in + install script only. + +install --- Unix shell (sh) script to install nad2nad file and proj + init files. Read beginning for usage instructions. + +test27 --- Unix shell (sh) scripts to test installation of +test83 proj and nad27/nad83 init files. These scripts + expect release 4 proj to reside in ../src. + +pj_out27 --- Comparison files for above test procedures. +pj_out83 + +The following NADCON conversion files are distributed in separate, +uncompressed distibution file(s). + + Ascii source (in delta format) of grid data to convert geographic + coordinates from NAD27 to NAD83 +alaska.lla.Z --- Alaska +conus.lla.Z --- Conterminous U.S. +hawaii.lla.Z --- Hawaii +prvi.lla.Z --- Puerto Rico, Virgin Is. +stgeorge.lla.Z --- St. George Is, Alaska +stlrnc.lla.Z --- St. Lawrence Is., Alaska +stpaul.lla.Z --- St. Paul Is., Alaska + + Ascii source (in delta format) of grid data for high precision + conversion of geographic coordinates from NAD83 to NAD83 +FL.lla.Z --- Florida +MD.lla.Z --- Maryland +TN.lla.Z --- Tennessee +WI.lla.Z --- Wisconsin +WO.lla.Z --- Washington, Oregon, N. California diff --git a/nad/install b/nad/install new file mode 100644 index 00000000..4f21abb3 --- /dev/null +++ b/nad/install @@ -0,0 +1,54 @@ +# Generated automatically from install.in by configure. +: +# SCCSID @(#)install.in 4.8 95/09/24 GIE REL +# +# Installation script all PROJ.4 system reference files. +# +# This script must be executed after compilation of proj library. +# +# Execute as: +# +# install +# +# ------------------------------------------------------------ +prefix=/usr/local +# +lib=${prefix}/lib/proj.4 +# Copy in "init" files +for x in proj_def.dat nad27 nad83 world GL27 +do + cp $x ${lib}/$x + if [ $? -ne 0 ] ; then + echo "init copying failed for file $x" + else + echo "file $x installed" + fi +done +# just test for conus and assume others are there +if [ -f conus.lla ] ; then +# install nad2nad NADCON files + echo "installing ${lib}/nad2783" + lib=${lib}/nad2783 + if [ ! -d $lib ] ; then + mkdir $lib + if [ $? -ne 0 ] ; then + echo "failed to make dir $lib" + echo "nad2nad lib install stopped" + exit 1 + fi + fi +# Process ascii grid into nad2nad compatible files. + for x in *.lla ; do + dest=`expr $x : '\(.*\)\.lla'` + cat < $x | ../src/nad2bin ${lib}/${dest} + if [ $? -ne 0 ] ; then + echo "nad2nad file install failed on file ${lib}/${dest}" + exit 1 + fi + echo "${lib}/${dest} installed" + done +else + echo "nad2nad NADCON files not present" +fi +echo "normal completion" +exit 0 diff --git a/nad/install.in b/nad/install.in new file mode 100755 index 00000000..d60dc725 --- /dev/null +++ b/nad/install.in @@ -0,0 +1,53 @@ +: +# SCCSID @(#)install.in 4.8 95/09/24 GIE REL +# +# Installation script all PROJ.4 system reference files. +# +# This script must be executed after compilation of proj library. +# +# Execute as: +# +# install +# +# ------------------------------------------------------------ +prefix=/usr/local +# +lib=${prefix}/lib/proj.4 +# Copy in "init" files +for x in proj_def.dat nad27 nad83 world GL27 +do + cp $x ${lib}/$x + if [ $? -ne 0 ] ; then + echo "init copying failed for file $x" + else + echo "file $x installed" + fi +done +# just test for conus and assume others are there +if [ -f conus.lla ] ; then +# install nad2nad NADCON files + echo "installing ${lib}/nad2783" + lib=${lib}/nad2783 + if [ ! -d $lib ] ; then + mkdir $lib + if [ $? -ne 0 ] ; then + echo "failed to make dir $lib" + echo "nad2nad lib install stopped" + exit 1 + fi + fi +# Process ascii grid into nad2nad compatible files. + for x in *.lla ; do + dest=`expr $x : '\(.*\)\.lla'` + cat < $x | ../src/nad2bin ${lib}/${dest} + if [ $? -ne 0 ] ; then + echo "nad2nad file install failed on file ${lib}/${dest}" + exit 1 + fi + echo "${lib}/${dest} installed" + done +else + echo "nad2nad NADCON files not present" +fi +echo "normal completion" +exit 0 diff --git a/nad/nad.lst b/nad/nad.lst new file mode 100644 index 00000000..cc427722 --- /dev/null +++ b/nad/nad.lst @@ -0,0 +1,142 @@ + Listing of State Plane North American Datum Zones + + NGS zone number + State and zone 1927 1983 + +Alabama east .................. 101 101 +Alabama west .................. 102 102 +Alaska zone no. 1 ............. 5001 5001 +Alaska zone no. 2 ............. 5002 5002 +Alaska zone no. 3 ............. 5003 5003 +Alaska zone no. 4 ............. 5004 5004 +Alaska zone no. 5 ............. 5005 5005 +Alaska zone no. 6 ............. 5006 5006 +Alaska zone no. 7 ............. 5007 5007 +Alaska zone no. 8 ............. 5008 5008 +Alaska zone no. 9 ............. 5009 5009 +Alaska zone no. 10 ............ 5010 5010 +American Samoa ................ 5300 +Arizona central ............... 202 202 +Arizona east .................. 201 201 +Arizona west .................. 203 203 +Arkansas north ................ 301 301 +Arkansas south ................ 302 302 +California I .................. 401 401 +California II ................. 402 402 +California III ................ 403 403 +California IV ................. 404 404 +California V .................. 405 405 +California VI ................. 406 406 +California VII ................ 407 +Colorado central .............. 502 502 +Colorado north ................ 501 501 +Colorado south ................ 503 503 +Connecticut ................... 600 600 +Delaware ...................... 700 700 +Florida east .................. 901 901 +Florida north ................. 903 903 +Florida west .................. 902 902 +Georgia east .................. 1001 1001 +Georgia west .................. 1002 1002 +Guam Island ................... 5400 +Hawaii 1 ...................... 5101 5101 +Hawaii 2 ...................... 5102 5102 +Hawaii 3 ...................... 5103 5103 +Hawaii 4 ...................... 5104 5104 +Hawaii 5 ...................... 5105 5105 +Idaho central ................. 1102 1102 +Idaho east .................... 1101 1101 +Idaho west .................... 1103 1103 +Illinois east ................. 1201 1201 +Illinois west ................. 1202 1202 +Indiana east .................. 1301 1301 +Indiana west .................. 1302 1302 +Iowa north .................... 1401 1401 +Iowa south .................... 1402 1402 +Kansas north .................. 1501 1501 +Kansas south .................. 1502 1502 +Kentucky north ................ 1601 1601 +Kentucky south ................ 1602 1602 +Louisiana north ............... 1701 1701 +Louisiana offshore ............ 1703 1703 +Louisiana south ............... 1702 1702 +Maine east .................... 1801 1801 +Maine west .................... 1802 1802 +Maryland ...................... 1900 1900 +Massachusetts island .......... 2002 2002 +Massachusetts mainland ........ 2001 2001 +Michigan central/l ............ 2112 2112 current +Michigan central/m ............ 2102 old +Michigan east ................. 2101 old +Michigan north ................ 2111 2111 current +Michigan south ................ 2113 2113 current +Michigan west ................. 2103 old +Minnesota central ............. 2202 2202 +Minnesota north ............... 2201 2201 +Minnesota south ............... 2203 2203 +Mississippi east .............. 2301 2301 +Mississippi west .............. 2302 2302 +Missouri central .............. 2402 2402 +Missouri east ................. 2401 2401 +Missouri west ................. 2403 2403 +Montana ....................... 2500 +Montana central ............... 2502 +Montana north ................. 2501 +Montana south ................. 2503 +Nebraska ...................... 2600 +Nebraska north ................ 2601 +Nebraska south ................ 2602 +Nevada central ................ 2702 2702 +Nevada east ................... 2701 2701 +Nevada west ................... 2703 2703 +New hampshire ................. 2800 2800 +New jersey .................... 2900 2900 +New mexico central ............ 3002 3002 +New mexico east ............... 3001 3001 +New mexico west ............... 3003 3003 +New york central .............. 3102 3102 +New york east ................. 3101 3101 +New york long island .......... 3104 3104 +New york west ................. 3103 3103 +North carolina ................ 3200 3200 +North dakota north ............ 3301 3301 +North dakota south ............ 3302 3302 +Ohio north .................... 3401 3401 +Ohio south .................... 3402 3402 +Oklahoma north ................ 3501 3501 +Oklahoma south ................ 3502 3502 +Oregon north .................. 3601 3601 +Oregon south .................. 3602 3602 +Pennsylvania north ............ 3701 3701 +Pennsylvania south ............ 3702 3702 +Puerto Rico, Virgin Islands ... 5201 5200 +Rhode Island .................. 3800 3800 +South Carolina ................ 3900 +South Carolina north .......... 3901 +South Carolina south .......... 3902 +South Dakota north ............ 4001 4001 +South Dakota south ............ 4002 4002 +Tennessee ..................... 4100 4100 +Texas central ................. 4203 4203 +Texas north ................... 4201 4201 +Texas north central ........... 4202 4202 +Texas south ................... 4205 4205 +Texas south central ........... 4204 4204 +Utah central .................. 4302 4302 +Utah north .................... 4301 4301 +Utah south .................... 4303 4303 +Vermont ....................... 4400 4400 +Virgin Islands, St. Croix ..... 5202 +Virginia north ................ 4501 4501 +Virginia south ................ 4502 4502 +Washington north .............. 4601 4601 +Washington south .............. 4602 4602 +West Virginia north ........... 4701 4701 +West Virginia south ........... 4702 4702 +Wisconsin central ............. 4802 4802 +Wisconsin north ............... 4801 4801 +Wisconsin south ............... 4803 4803 +Wyoming east .................. 4901 4901 +Wyoming east central .......... 4902 4902 +Wyoming west .................. 4904 4904 +Wyoming west central .......... 4903 4903 diff --git a/nad/nad27 b/nad/nad27 new file mode 100644 index 00000000..31c907f9 --- /dev/null +++ b/nad/nad27 @@ -0,0 +1,809 @@ +# SCCSID @(#)nad27 4.1 92/12/20 GIE +# proj +init files for: +# +# State Plane Coordinate Systems, +# North American Datum 1927 + +# 101: alabama east: nad27 +<101> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-85d50 lat_0=30d30 k=.99996 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 102: alabama west: nad27 +<102> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-87d30 lat_0=30 k=.9999333333333333 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5010: alaska zone no. 10: nad27 +<5010> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-176 lat_1=53d50 lat_2=51d50 lat_0=51 +x_0=914401.8288036576 y_0=0 +no_defs <> + +# 5300: american samoa: nad27 +<5300> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-170 lat_1=-14d16 lat_2=-14d16 lat_0=-14d16 +x_0=152400.3048006096 y_0=95169.31165862332 +no_defs <> + +# 201: arizona east: nad27 +<201> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-110d10 lat_0=31 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 202: arizona central: nad27 +<202> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-111d55 lat_0=31 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 203: arizona west: nad27 +<203> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-113d45 lat_0=31 k=.9999333333333333 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 301: arkansas north: nad27 +<301> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-92 lat_1=36d14 lat_2=34d56 lat_0=34d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 302: arkansas south: nad27 +<302> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-92 lat_1=34d46 lat_2=33d18 lat_0=32d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 401: california i: nad27 +<401> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-122 lat_1=41d40 lat_2=40 lat_0=39d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 402: california ii: nad27 +<402> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-122 lat_1=39d50 lat_2=38d20 lat_0=37d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 403: california iii: nad27 +<403> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-120d30 lat_1=38d26 lat_2=37d4 lat_0=36d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 404: california iv: nad27 +<404> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-119 lat_1=37d15 lat_2=36 lat_0=35d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 405: california v: nad27 +<405> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-118 lat_1=35d28 lat_2=34d2 lat_0=33d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 406: california vi: nad27 +<406> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-116d15 lat_1=33d53 lat_2=32d47 lat_0=32d10 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 407: california vii: nad27 +<407> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-118d20 lat_1=34d25 lat_2=33d52 lat_0=34d8 +x_0=1276106.450596901 y_0=1268253.006858014 +no_defs <> + +# 501: colorado north: nad27 +<501> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-105d30 lat_1=40d47 lat_2=39d43 lat_0=39d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 502: colorado central: nad27 +<502> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-105d30 lat_1=39d45 lat_2=38d27 lat_0=37d50 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 503: colorado south: nad27 +<503> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-105d30 lat_1=38d26 lat_2=37d14 lat_0=36d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 600: connecticut ---: nad27 +<600> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-72d45 lat_1=41d52 lat_2=41d12 lat_0=40d50 +x_0=182880.3657607315 y_0=0 +no_defs <> + +# 700: delaware ---: nad27 +<700> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-75d25 lat_0=38 k=.999995 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 901: florida east: nad27 +<901> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-81 lat_0=24d20 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 902: florida west: nad27 +<902> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-82 lat_0=24d20 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 903: florida north: nad27 +<903> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-84d30 lat_1=30d45 lat_2=29d35 lat_0=29 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1001: georgia east: nad27 +<1001> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-82d10 lat_0=30 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1002: georgia west: nad27 +<1002> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-84d10 lat_0=30 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5101: hawaii 1: nad27 +<5101> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-155d30 lat_0=18d50 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5102: hawaii 2: nad27 +<5102> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-156d40 lat_0=20d20 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5103: hawaii 3: nad27 +<5103> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-158 lat_0=21d10 k=.99999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5104: hawaii 4: nad27 +<5104> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-159d30 lat_0=21d50 k=.99999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5105: hawaii 5: nad27 +<5105> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-160d10 lat_0=21d40 k=1 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1101: idaho east: nad27 +<1101> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-112d10 lat_0=41d40 k=.9999473684210526 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1102: idaho central: nad27 +<1102> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-114 lat_0=41d40 k=.9999473684210526 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1103: idaho west: nad27 +<1103> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-115d45 lat_0=41d40 k=.9999333333333333 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1201: illinois east: nad27 +<1201> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-88d20 lat_0=36d40 k=.999975 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1202: illinois west: nad27 +<1202> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-90d10 lat_0=36d40 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1301: indiana east: nad27 +<1301> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-85d40 lat_0=37d30 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1302: indiana west: nad27 +<1302> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-87d5 lat_0=37d30 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1401: iowa north: nad27 +<1401> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-93d30 lat_1=43d16 lat_2=42d4 lat_0=41d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1402: iowa south: nad27 +<1402> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-93d30 lat_1=41d47 lat_2=40d37 lat_0=40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1501: kansas north: nad27 +<1501> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-98 lat_1=39d47 lat_2=38d43 lat_0=38d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1502: kansas south: nad27 +<1502> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-98d30 lat_1=38d34 lat_2=37d16 lat_0=36d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1601: kentucky north: nad27 +<1601> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-84d15 lat_1=38d58 lat_2=37d58 lat_0=37d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1602: kentucky south: nad27 +<1602> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-85d45 lat_1=37d56 lat_2=36d44 lat_0=36d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1701: louisiana north: nad27 +<1701> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-92d30 lat_1=32d40 lat_2=31d10 lat_0=30d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1702: louisiana south: nad27 +<1702> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-91d20 lat_1=30d42 lat_2=29d18 lat_0=28d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1703: louisiana offshore: nad27 +<1703> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-91d20 lat_1=27d50 lat_2=26d10 lat_0=25d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 1801: maine east: nad27 +<1801> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-68d30 lat_0=43d50 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1802: maine west: nad27 +<1802> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-70d10 lat_0=42d50 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 1900: maryland ---: nad27 +<1900> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-77 lat_1=39d27 lat_2=38d18 lat_0=37d50 +x_0=243840.4876809754 y_0=0 +no_defs <> + +# 2001: massachusetts mainland: nad27 +<2001> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-71d30 lat_1=42d41 lat_2=41d43 lat_0=41 +x_0=182880.3657607315 y_0=0 +no_defs <> + +# 2002: massachusetts island: nad27 +<2002> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-70d30 lat_1=41d29 lat_2=41d17 lat_0=41 +x_0=60960.12192024384 y_0=0 +no_defs <> + +# 2101: michigan east: nad27 +<2101> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-83d40 lat_0=41d30 k=.9999428571428571 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2102: michigan central/m: nad27 +<2102> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-85d45 lat_0=41d30 k=.9999090909090909 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2103: michigan west: nad27 +<2103> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-88d45 lat_0=41d30 k=.9999090909090909 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2111: michigan north: nad27 +<2111> proj=lcc a=6378450.047 es=.006768657997291094 +lon_0=-87 lat_1=47d5 lat_2=45d29 lat_0=44d47 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2112: michigan central/l: nad27 +<2112> proj=lcc a=6378450.047 es=.006768657997291094 +lon_0=-84d20 lat_1=45d42 lat_2=44d11 lat_0=43d19 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2113: michigan south: nad27 +<2113> proj=lcc a=6378450.047 es=.006768657997291094 +lon_0=-84d20 lat_1=43d40 lat_2=42d6 lat_0=41d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2201: minnesota north: nad27 +<2201> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-93d6 lat_1=48d38 lat_2=47d2 lat_0=46d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2202: minnesota central: nad27 +<2202> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-94d15 lat_1=47d3 lat_2=45d37 lat_0=45 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2203: minnesota south: nad27 +<2203> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-94 lat_1=45d13 lat_2=43d47 lat_0=43 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2301: mississippi east: nad27 +<2301> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-88d50 lat_0=29d40 k=.99996 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2302: mississippi west: nad27 +<2302> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-90d20 lat_0=30d30 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2401: missouri east: nad27 +<2401> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-90d30 lat_0=35d50 k=.9999333333333333 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2402: missouri central: nad27 +<2402> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-92d30 lat_0=35d50 k=.9999333333333333 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2403: missouri west: nad27 +<2403> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-94d30 lat_0=36d10 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2501: montana north: nad27 +<2501> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-109d30 lat_1=48d43 lat_2=47d51 lat_0=47 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2502: montana central: nad27 +<2502> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-109d30 lat_1=47d53 lat_2=46d27 lat_0=45d50 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2503: montana south: nad27 +<2503> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-109d30 lat_1=46d24 lat_2=44d52 lat_0=44 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2601: nebraska north: nad27 +<2601> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-100 lat_1=42d49 lat_2=41d51 lat_0=41d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2602: nebraska south: nad27 +<2602> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-99d30 lat_1=41d43 lat_2=40d17 lat_0=39d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 2701: nevada east: nad27 +<2701> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-115d35 lat_0=34d45 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2702: nevada central: nad27 +<2702> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-116d40 lat_0=34d45 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2703: nevada west: nad27 +<2703> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-118d35 lat_0=34d45 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2800: new hampshire ---: nad27 +<2800> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-71d40 lat_0=42d30 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 2900: new jersey ---: nad27 +<2900> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-74d40 lat_0=38d50 k=.999975 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3001: new mexico east: nad27 +<3001> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-104d20 lat_0=31 k=.9999090909090909 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3002: new mexico central: nad27 +<3002> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-106d15 lat_0=31 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3003: new mexico west: nad27 +<3003> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-107d50 lat_0=31 k=.9999166666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3101: new york east: nad27 +<3101> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-74d20 lat_0=40 k=.9999666666666667 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3102: new york central: nad27 +<3102> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-76d35 lat_0=40 k=.9999375 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3103: new york west: nad27 +<3103> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-78d35 lat_0=40 k=.9999375 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3104: new york long island: nad27 +<3104> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-74 lat_1=41d2 lat_2=40d40 lat_0=40d30 +x_0=609601.2192024384 y_0=30480.06096012192 +no_defs <> + +# 3200: north carolina ---: nad27 +<3200> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-79 lat_1=36d10 lat_2=34d20 lat_0=33d45 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3301: north dakota north: nad27 +<3301> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-100d30 lat_1=48d44 lat_2=47d26 lat_0=47 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3302: north dakota south: nad27 +<3302> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-100d30 lat_1=47d29 lat_2=46d11 lat_0=45d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3401: ohio north: nad27 +<3401> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-82d30 lat_1=41d42 lat_2=40d26 lat_0=39d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3402: ohio south: nad27 +<3402> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-82d30 lat_1=40d2 lat_2=38d44 lat_0=38 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3501: oklahoma north: nad27 +<3501> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-98 lat_1=36d46 lat_2=35d34 lat_0=35 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3502: oklahoma south: nad27 +<3502> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-98 lat_1=35d14 lat_2=33d56 lat_0=33d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3601: oregon north: nad27 +<3601> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-120d30 lat_1=46 lat_2=44d20 lat_0=43d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3602: oregon south: nad27 +<3602> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-120d30 lat_1=44 lat_2=42d20 lat_0=41d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3701: pennsylvania north: nad27 +<3701> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-77d45 lat_1=41d57 lat_2=40d53 lat_0=40d10 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3702: pennsylvania south: nad27 +<3702> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-77d45 lat_1=40d58 lat_2=39d56 lat_0=39d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3800: rhode island ---: nad27 +<3800> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-71d30 lat_0=41d5 k=.99999375 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 3901: south carolina north: nad27 +<3901> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-81 lat_1=34d58 lat_2=33d46 lat_0=33 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 3902: south carolina south: nad27 +<3902> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-81 lat_1=33d40 lat_2=32d20 lat_0=31d50 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4001: south dakota north: nad27 +<4001> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-100 lat_1=45d41 lat_2=44d25 lat_0=43d50 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4002: south dakota south: nad27 +<4002> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-100d20 lat_1=44d24 lat_2=42d50 lat_0=42d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4100: tennessee ---: nad27 +<4100> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-86 lat_1=36d25 lat_2=35d15 lat_0=34d40 +x_0=609601.2192024384 y_0=30480.06096012192 +no_defs <> + +# 4201: texas north: nad27 +<4201> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-101d30 lat_1=36d11 lat_2=34d39 lat_0=34 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4202: texas north central: nad27 +<4202> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-97d30 lat_1=33d58 lat_2=32d8 lat_0=31d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4203: texas central: nad27 +<4203> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-100d20 lat_1=31d53 lat_2=30d7 lat_0=29d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4204: texas south central: nad27 +<4204> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-99 lat_1=30d17 lat_2=28d23 lat_0=27d50 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4205: texas south: nad27 +<4205> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-98d30 lat_1=27d50 lat_2=26d10 lat_0=25d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4301: utah north: nad27 +<4301> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-111d30 lat_1=41d47 lat_2=40d43 lat_0=40d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4302: utah central: nad27 +<4302> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-111d30 lat_1=40d39 lat_2=39d1 lat_0=38d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4303: utah south: nad27 +<4303> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-111d30 lat_1=38d21 lat_2=37d13 lat_0=36d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4400: vermont ---: nad27 +<4400> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-72d30 lat_0=42d30 k=.9999642857142857 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 4501: virginia north: nad27 +<4501> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-78d30 lat_1=39d12 lat_2=38d2 lat_0=37d40 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4502: virginia south: nad27 +<4502> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-78d30 lat_1=37d58 lat_2=36d46 lat_0=36d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4601: washington north: nad27 +<4601> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-120d50 lat_1=48d44 lat_2=47d30 lat_0=47 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4602: washington south: nad27 +<4602> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-120d30 lat_1=47d20 lat_2=45d50 lat_0=45d20 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4701: west virginia north: nad27 +<4701> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-79d30 lat_1=40d15 lat_2=39 lat_0=38d30 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4702: west virginia south: nad27 +<4702> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-81 lat_1=38d53 lat_2=37d29 lat_0=37 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4801: wisconsin north: nad27 +<4801> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-90 lat_1=46d46 lat_2=45d34 lat_0=45d10 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4802: wisconsin central: nad27 +<4802> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-90 lat_1=45d30 lat_2=44d15 lat_0=43d50 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4803: wisconsin south: nad27 +<4803> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-90 lat_1=44d4 lat_2=42d44 lat_0=42 +x_0=609601.2192024384 y_0=0 +no_defs <> + +# 4901: wyoming east: nad27 +<4901> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-105d10 lat_0=40d40 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 4902: wyoming east central: nad27 +<4902> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-107d20 lat_0=40d40 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 4903: wyoming west central: nad27 +<4903> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-108d45 lat_0=40d40 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 4904: wyoming west: nad27 +<4904> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-110d5 lat_0=40d40 k=.9999411764705882 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5001: alaska zone no. 1: nad27 +<5001> proj=omerc a=6378206.4 es=.006768657997291094 +k=.9999 lonc=-133d40 lat_0=57 alpha=-36d52'11.6315 +x_0=818585.5672270928 y_0=575219.2451072642 +no_defs <> + +# 5002: alaska zone no. 2: nad27 +<5002> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-142 lat_0=54 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5003: alaska zone no. 3: nad27 +<5003> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-146 lat_0=54 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5004: alaska zone no. 4: nad27 +<5004> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-150 lat_0=54 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5005: alaska zone no. 5: nad27 +<5005> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-154 lat_0=54 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5006: alaska zone no. 6: nad27 +<5006> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-158 lat_0=54 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5007: alaska zone no. 7: nad27 +<5007> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-162 lat_0=54 k=.9999 +x_0=213360.4267208534 y_0=0 +no_defs <> + +# 5008: alaska zone no. 8: nad27 +<5008> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-166 lat_0=54 k=.9999 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5009: alaska zone no. 9: nad27 +<5009> proj=tmerc a=6378206.4 es=.006768657997291094 +lon_0=-170 lat_0=54 k=.9999 +x_0=182880.3657607315 y_0=0 +no_defs <> + +# 5201: puerto rico and virgin islands: nad27 +<5201> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-66d26 lat_1=18d26 lat_2=18d2 lat_0=17d50 +x_0=152400.3048006096 y_0=0 +no_defs <> + +# 5202: virgin islands st. croix: nad27 +<5202> proj=lcc a=6378206.4 es=.006768657997291094 +lon_0=-66d26 lat_1=18d26 lat_2=18d2 lat_0=17d50 +x_0=152400.3048006096 y_0=30480.06096012192 +no_defs <> + +# 5400: guam island: nad27 +<5400> proj=poly a=6378206.4 es=.006768657997291094 +x_0=50000 y_0=50000 lon_0=144d44'55.50254 lat_0=13d28'20.87887 +no_defs <> + diff --git a/nad/nad83 b/nad/nad83 new file mode 100644 index 00000000..919944a7 --- /dev/null +++ b/nad/nad83 @@ -0,0 +1,744 @@ +# SCCSID @(#)nad83 4.1 92/12/20 GIE +# proj +init files for: +# +# State Plane Coordinate Systems, +# North American Datum 1983 + +# 101: alabama east: nad83 +<101> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-85d50 lat_0=30d30 k=.99996 +x_0=200000 y_0=0 +no_defs <> + +# 102: alabama west: nad83 +<102> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-87d30 lat_0=30 k=.9999333333333333 +x_0=600000 y_0=0 +no_defs <> + +# 5010: alaska zone no. 10: nad83 +<5010> proj=lcc a=6378137 es=.0066943800229 +lon_0=-176 lat_1=53d50 lat_2=51d50 lat_0=51 +x_0=1000000 y_0=0 +no_defs <> + +# 201: arizona east: nad83 +<201> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-110d10 lat_0=31 k=.9999 +x_0=213360 y_0=0 +no_defs <> + +# 202: arizona central: nad83 +<202> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-111d55 lat_0=31 k=.9999 +x_0=213360 y_0=0 +no_defs <> + +# 203: arizona west: nad83 +<203> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-113d45 lat_0=31 k=.9999333333333333 +x_0=213360 y_0=0 +no_defs <> + +# 301: arkansas north: nad83 +<301> proj=lcc a=6378137 es=.0066943800229 +lon_0=-92 lat_1=36d14 lat_2=34d56 lat_0=34d20 +x_0=400000 y_0=0 +no_defs <> + +# 302: arkansas south: nad83 +<302> proj=lcc a=6378137 es=.0066943800229 +lon_0=-92 lat_1=34d46 lat_2=33d18 lat_0=32d40 +x_0=400000 y_0=400000 +no_defs <> + +# 401: california i: nad83 +<401> proj=lcc a=6378137 es=.0066943800229 +lon_0=-122 lat_1=41d40 lat_2=40 lat_0=39d20 +x_0=2000000 y_0=500000 +no_defs <> + +# 402: california ii: nad83 +<402> proj=lcc a=6378137 es=.0066943800229 +lon_0=-122 lat_1=39d50 lat_2=38d20 lat_0=37d40 +x_0=2000000 y_0=500000 +no_defs <> + +# 403: california iii: nad83 +<403> proj=lcc a=6378137 es=.0066943800229 +lon_0=-120d30 lat_1=38d26 lat_2=37d4 lat_0=36d30 +x_0=2000000 y_0=500000 +no_defs <> + +# 404: california iv: nad83 +<404> proj=lcc a=6378137 es=.0066943800229 +lon_0=-119 lat_1=37d15 lat_2=36 lat_0=35d20 +x_0=2000000 y_0=500000 +no_defs <> + +# 405: california v: nad83 +<405> proj=lcc a=6378137 es=.0066943800229 +lon_0=-118 lat_1=35d28 lat_2=34d2 lat_0=33d30 +x_0=2000000 y_0=500000 +no_defs <> + +# 406: california vi: nad83 +<406> proj=lcc a=6378137 es=.0066943800229 +lon_0=-116d15 lat_1=33d53 lat_2=32d47 lat_0=32d10 +x_0=2000000 y_0=500000 +no_defs <> + +# 501: colorado north: nad83 +<501> proj=lcc a=6378137 es=.0066943800229 +lon_0=-105d30 lat_1=40d47 lat_2=39d43 lat_0=39d20 +x_0=914401.8289 y_0=304800.6096 +no_defs <> + +# 502: colorado central: nad83 +<502> proj=lcc a=6378137 es=.0066943800229 +lon_0=-105d30 lat_1=39d45 lat_2=38d27 lat_0=37d50 +x_0=914401.8289 y_0=304800.6096 +no_defs <> + +# 503: colorado south: nad83 +<503> proj=lcc a=6378137 es=.0066943800229 +lon_0=-105d30 lat_1=38d26 lat_2=37d14 lat_0=36d40 +x_0=914401.8289 y_0=304800.6096 +no_defs <> + +# 600: connecticut ---: nad83 +<600> proj=lcc a=6378137 es=.0066943800229 +lon_0=-72d45 lat_1=41d52 lat_2=41d12 lat_0=40d50 +x_0=304800.6096 y_0=152400.3048 +no_defs <> + +# 700: delaware ---: nad83 +<700> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-75d25 lat_0=38 k=.999995 +x_0=200000 y_0=0 +no_defs <> + +# 901: florida east: nad83 +<901> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-81 lat_0=24d20 k=.9999411764705882 +x_0=200000 y_0=0 +no_defs <> + +# 902: florida west: nad83 +<902> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-82 lat_0=24d20 k=.9999411764705882 +x_0=200000 y_0=0 +no_defs <> + +# 903: florida north: nad83 +<903> proj=lcc a=6378137 es=.0066943800229 +lon_0=-84d30 lat_1=30d45 lat_2=29d35 lat_0=29 +x_0=600000 y_0=0 +no_defs <> + +# 1001: georgia east: nad83 +<1001> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-82d10 lat_0=30 k=.9999 +x_0=200000 y_0=0 +no_defs <> + +# 1002: georgia west: nad83 +<1002> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-84d10 lat_0=30 k=.9999 +x_0=700000 y_0=0 +no_defs <> + +# 5101: hawaii 1: nad83 +<5101> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-155d30 lat_0=18d50 k=.9999666666666667 +x_0=500000 y_0=0 +no_defs <> + +# 5102: hawaii 2: nad83 +<5102> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-156d40 lat_0=20d20 k=.9999666666666667 +x_0=500000 y_0=0 +no_defs <> + +# 5103: hawaii 3: nad83 +<5103> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-158 lat_0=21d10 k=.99999 +x_0=500000 y_0=0 +no_defs <> + +# 5104: hawaii 4: nad83 +<5104> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-159d30 lat_0=21d50 k=.99999 +x_0=500000 y_0=0 +no_defs <> + +# 5105: hawaii 5: nad83 +<5105> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-160d10 lat_0=21d40 k=1 +x_0=500000 y_0=0 +no_defs <> + +# 1101: idaho east: nad83 +<1101> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-112d10 lat_0=41d40 k=.9999473684210526 +x_0=200000 y_0=0 +no_defs <> + +# 1102: idaho central: nad83 +<1102> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-114 lat_0=41d40 k=.9999473684210526 +x_0=500000 y_0=0 +no_defs <> + +# 1103: idaho west: nad83 +<1103> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-115d45 lat_0=41d40 k=.9999333333333333 +x_0=800000 y_0=0 +no_defs <> + +# 1201: illinois east: nad83 +<1201> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-88d20 lat_0=36d40 k=.999975 +x_0=300000 y_0=0 +no_defs <> + +# 1202: illinois west: nad83 +<1202> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-90d10 lat_0=36d40 k=.9999411764705882 +x_0=700000 y_0=0 +no_defs <> + +# 1301: indiana east: nad83 +<1301> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-85d40 lat_0=37d30 k=.9999666666666667 +x_0=100000 y_0=250000 +no_defs <> + +# 1302: indiana west: nad83 +<1302> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-87d5 lat_0=37d30 k=.9999666666666667 +x_0=900000 y_0=250000 +no_defs <> + +# 1401: iowa north: nad83 +<1401> proj=lcc a=6378137 es=.0066943800229 +lon_0=-93d30 lat_1=43d16 lat_2=42d4 lat_0=41d30 +x_0=1500000 y_0=1000000 +no_defs <> + +# 1402: iowa south: nad83 +<1402> proj=lcc a=6378137 es=.0066943800229 +lon_0=-93d30 lat_1=41d47 lat_2=40d37 lat_0=40 +x_0=500000 y_0=0 +no_defs <> + +# 1501: kansas north: nad83 +<1501> proj=lcc a=6378137 es=.0066943800229 +lon_0=-98 lat_1=39d47 lat_2=38d43 lat_0=38d20 +x_0=400000 y_0=0 +no_defs <> + +# 1502: kansas south: nad83 +<1502> proj=lcc a=6378137 es=.0066943800229 +lon_0=-98d30 lat_1=38d34 lat_2=37d16 lat_0=36d40 +x_0=400000 y_0=400000 +no_defs <> + +# 1601: kentucky north: nad83 +<1601> proj=lcc a=6378137 es=.0066943800229 +lon_0=-84d15 lat_1=38d58 lat_2=37d58 lat_0=37d30 +x_0=500000 y_0=0 +no_defs <> + +# 1602: kentucky south: nad83 +<1602> proj=lcc a=6378137 es=.0066943800229 +lon_0=-85d45 lat_1=37d56 lat_2=36d44 lat_0=36d20 +x_0=500000 y_0=500000 +no_defs <> + +# 1701: louisiana north: nad83 +<1701> proj=lcc a=6378137 es=.0066943800229 +lon_0=-92d30 lat_1=32d40 lat_2=31d10 lat_0=30d30 +x_0=1000000 y_0=0 +no_defs <> + +# 1702: louisiana south: nad83 +<1702> proj=lcc a=6378137 es=.0066943800229 +lon_0=-91d20 lat_1=30d42 lat_2=29d18 lat_0=28d30 +x_0=1000000 y_0=0 +no_defs <> + +# 1703: louisiana offshore: nad83 +<1703> proj=lcc a=6378137 es=.0066943800229 +lon_0=-91d20 lat_1=27d50 lat_2=26d10 lat_0=25d30 +x_0=1000000 y_0=0 +no_defs <> + +# 1801: maine east: nad83 +<1801> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-68d30 lat_0=43d40 k=.9999 +x_0=300000 y_0=0 +no_defs <> + +# 1802: maine west: nad83 +<1802> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-70d10 lat_0=42d50 k=.9999666666666667 +x_0=900000 y_0=0 +no_defs <> + +# 1900: maryland ---: nad83 +<1900> proj=lcc a=6378137 es=.0066943800229 +lon_0=-77 lat_1=39d27 lat_2=38d18 lat_0=37d40 +x_0=400000 y_0=0 +no_defs <> + +# 2001: massachusetts mainland: nad83 +<2001> proj=lcc a=6378137 es=.0066943800229 +lon_0=-71d30 lat_1=42d41 lat_2=41d43 lat_0=41 +x_0=200000 y_0=750000 +no_defs <> + +# 2002: massachusetts island: nad83 +<2002> proj=lcc a=6378137 es=.0066943800229 +lon_0=-70d30 lat_1=41d29 lat_2=41d17 lat_0=41 +x_0=500000 y_0=0 +no_defs <> + +# 2111: michigan north: nad83 +<2111> proj=lcc a=6378137 es=.0066943800229 +lon_0=-87 lat_1=47d5 lat_2=45d29 lat_0=44d47 +x_0=8000000 y_0=0 +no_defs <> + +# 2112: michigan central/l: nad83 +<2112> proj=lcc a=6378137 es=.0066943800229 +lon_0=-84d22 lat_1=45d42 lat_2=44d11 lat_0=43d19 +x_0=6000000 y_0=0 +no_defs <> + +# 2113: michigan south: nad83 +<2113> proj=lcc a=6378137 es=.0066943800229 +lon_0=-84d22 lat_1=43d40 lat_2=42d6 lat_0=41d30 +x_0=4000000 y_0=0 +no_defs <> + +# 2201: minnesota north: nad83 +<2201> proj=lcc a=6378137 es=.0066943800229 +lon_0=-93d6 lat_1=48d38 lat_2=47d2 lat_0=46d30 +x_0=800000 y_0=100000 +no_defs <> + +# 2202: minnesota central: nad83 +<2202> proj=lcc a=6378137 es=.0066943800229 +lon_0=-94d15 lat_1=47d3 lat_2=45d37 lat_0=45 +x_0=800000 y_0=100000 +no_defs <> + +# 2203: minnesota south: nad83 +<2203> proj=lcc a=6378137 es=.0066943800229 +lon_0=-94 lat_1=45d13 lat_2=43d47 lat_0=43 +x_0=800000 y_0=100000 +no_defs <> + +# 2301: mississippi east: nad83 +<2301> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-88d50 lat_0=29d30 k=.99995 +x_0=300000 y_0=0 +no_defs <> + +# 2302: mississippi west: nad83 +<2302> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-90d20 lat_0=29d30 k=.99995 +x_0=700000 y_0=0 +no_defs <> + +# 2401: missouri east: nad83 +<2401> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-90d30 lat_0=35d50 k=.9999333333333333 +x_0=250000 y_0=0 +no_defs <> + +# 2402: missouri central: nad83 +<2402> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-92d30 lat_0=35d50 k=.9999333333333333 +x_0=500000 y_0=0 +no_defs <> + +# 2403: missouri west: nad83 +<2403> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-94d30 lat_0=36d10 k=.9999411764705882 +x_0=850000 y_0=0 +no_defs <> + +# 2500: montana: nad83 +<2500> proj=lcc a=6378137 es=.0066943800229 +lon_0=-109d30 lat_1=49 lat_2=45 lat_0=44d15 +x_0=600000 y_0=0 +no_defs <> + +# 2600: nebraska: nad83 +<2600> proj=lcc a=6378137 es=.0066943800229 +lon_0=-100 lat_1=43 lat_2=40 lat_0=39d50 +x_0=500000 y_0=0 +no_defs <> + +# 2701: nevada east: nad83 +<2701> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-115d35 lat_0=34d45 k=.9999 +x_0=200000 y_0=8000000 +no_defs <> + +# 2702: nevada central: nad83 +<2702> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-116d40 lat_0=34d45 k=.9999 +x_0=500000 y_0=6000000 +no_defs <> + +# 2703: nevada west: nad83 +<2703> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-118d35 lat_0=34d45 k=.9999 +x_0=800000 y_0=4000000 +no_defs <> + +# 2800: new hampshire ---: nad83 +<2800> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-71d40 lat_0=42d30 k=.9999666666666667 +x_0=300000 y_0=0 +no_defs <> + +# 2900: new jersey ---: nad83 +<2900> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-74d30 lat_0=38d50 k=.9999 +x_0=150000 y_0=0 +no_defs <> + +# 3001: new mexico east: nad83 +<3001> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-104d20 lat_0=31 k=.9999090909090909 +x_0=165000 y_0=0 +no_defs <> + +# 3002: new mexico central: nad83 +<3002> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-106d15 lat_0=31 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 3003: new mexico west: nad83 +<3003> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-107d50 lat_0=31 k=.9999166666666667 +x_0=830000 y_0=0 +no_defs <> + +# 3101: new york east: nad83 +<3101> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-74d30 lat_0=38d50 k=.9999 +x_0=150000 y_0=0 +no_defs <> + +# 3102: new york central: nad83 +<3102> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-76d35 lat_0=40 k=.9999375 +x_0=250000 y_0=0 +no_defs <> + +# 3103: new york west: nad83 +<3103> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-78d35 lat_0=40 k=.9999375 +x_0=350000 y_0=0 +no_defs <> + +# 3104: new york long island: nad83 +<3104> proj=lcc a=6378137 es=.0066943800229 +lon_0=-74 lat_1=41d2 lat_2=40d40 lat_0=40d10 +x_0=300000 y_0=0 +no_defs <> + +# 3200: north carolina ---: nad83 +<3200> proj=lcc a=6378137 es=.0066943800229 +lon_0=-79 lat_1=36d10 lat_2=34d20 lat_0=33d45 +x_0=609601.22 y_0=0 +no_defs <> + +# 3301: north dakota north: nad83 +<3301> proj=lcc a=6378137 es=.0066943800229 +lon_0=-100d30 lat_1=48d44 lat_2=47d26 lat_0=47 +x_0=600000 y_0=0 +no_defs <> + +# 3302: north dakota south: nad83 +<3302> proj=lcc a=6378137 es=.0066943800229 +lon_0=-100d30 lat_1=47d29 lat_2=46d11 lat_0=45d40 +x_0=600000 y_0=0 +no_defs <> + +# 3401: ohio north: nad83 +<3401> proj=lcc a=6378137 es=.0066943800229 +lon_0=-82d30 lat_1=41d42 lat_2=40d26 lat_0=39d40 +x_0=600000 y_0=0 +no_defs <> + +# 3402: ohio south: nad83 +<3402> proj=lcc a=6378137 es=.0066943800229 +lon_0=-82d30 lat_1=40d2 lat_2=38d44 lat_0=38 +x_0=600000 y_0=0 +no_defs <> + +# 3501: oklahoma north: nad83 +<3501> proj=lcc a=6378137 es=.0066943800229 +lon_0=-98 lat_1=36d46 lat_2=35d34 lat_0=35 +x_0=600000 y_0=0 +no_defs <> + +# 3502: oklahoma south: nad83 +<3502> proj=lcc a=6378137 es=.0066943800229 +lon_0=-98 lat_1=35d14 lat_2=33d56 lat_0=33d20 +x_0=600000 y_0=0 +no_defs <> + +# 3601: oregon north: nad83 +<3601> proj=lcc a=6378137 es=.0066943800229 +lon_0=-120d30 lat_1=46 lat_2=44d20 lat_0=43d40 +x_0=2500000 y_0=0 +no_defs <> + +# 3602: oregon south: nad83 +<3602> proj=lcc a=6378137 es=.0066943800229 +lon_0=-120d30 lat_1=44 lat_2=42d20 lat_0=41d40 +x_0=1500000 y_0=0 +no_defs <> + +# 3701: pennsylvania north: nad83 +<3701> proj=lcc a=6378137 es=.0066943800229 +lon_0=-77d45 lat_1=41d57 lat_2=40d53 lat_0=40d10 +x_0=600000 y_0=0 +no_defs <> + +# 3702: pennsylvania south: nad83 +<3702> proj=lcc a=6378137 es=.0066943800229 +lon_0=-77d45 lat_1=40d58 lat_2=39d56 lat_0=39d20 +x_0=600000 y_0=0 +no_defs <> + +# 3800: rhode island ---: nad83 +<3800> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-71d30 lat_0=41d5 k=.99999375 +x_0=100000 y_0=0 +no_defs <> + +# 3900: south carolina: nad83 +<3900> proj=lcc a=6378137 es=.0066943800229 +lon_0=-81 lat_1=34d50 lat_2=32d30 lat_0=31d50 +x_0=609600 y_0=0 +no_defs <> + +# 4001: south dakota north: nad83 +<4001> proj=lcc a=6378137 es=.0066943800229 +lon_0=-100 lat_1=45d41 lat_2=44d25 lat_0=43d50 +x_0=600000 y_0=0 +no_defs <> + +# 4002: south dakota south: nad83 +<4002> proj=lcc a=6378137 es=.0066943800229 +lon_0=-100d20 lat_1=44d24 lat_2=42d50 lat_0=42d20 +x_0=600000 y_0=0 +no_defs <> + +# 4100: tennessee ---: nad83 +<4100> proj=lcc a=6378137 es=.0066943800229 +lon_0=-86 lat_1=36d25 lat_2=35d15 lat_0=34d20 +x_0=600000 y_0=0 +no_defs <> + +# 4201: texas north: nad83 +<4201> proj=lcc a=6378137 es=.0066943800229 +lon_0=-101d30 lat_1=36d11 lat_2=34d39 lat_0=34 +x_0=200000 y_0=1000000 +no_defs <> + +# 4202: texas north central: nad83 +<4202> proj=lcc a=6378137 es=.0066943800229 +lon_0=-98d30 lat_1=33d58 lat_2=32d8 lat_0=31d40 +x_0=600000 y_0=2000000 +no_defs <> + +# 4203: texas central: nad83 +<4203> proj=lcc a=6378137 es=.0066943800229 +lon_0=-100d20 lat_1=31d53 lat_2=30d7 lat_0=29d40 +x_0=700000 y_0=3000000 +no_defs <> + +# 4204: texas south central: nad83 +<4204> proj=lcc a=6378137 es=.0066943800229 +lon_0=-99 lat_1=30d17 lat_2=28d23 lat_0=27d50 +x_0=600000 y_0=4000000 +no_defs <> + +# 4205: texas south: nad83 +<4205> proj=lcc a=6378137 es=.0066943800229 +lon_0=-98d30 lat_1=27d50 lat_2=26d10 lat_0=25d40 +x_0=300000 y_0=5000000 +no_defs <> + +# 4301: utah north: nad83 +<4301> proj=lcc a=6378137 es=.0066943800229 +lon_0=-111d30 lat_1=41d47 lat_2=40d43 lat_0=40d20 +x_0=500000 y_0=1000000 +no_defs <> + +# 4302: utah central: nad83 +<4302> proj=lcc a=6378137 es=.0066943800229 +lon_0=-111d30 lat_1=40d39 lat_2=39d1 lat_0=38d20 +x_0=500000 y_0=2000000 +no_defs <> + +# 4303: utah south: nad83 +<4303> proj=lcc a=6378137 es=.0066943800229 +lon_0=-111d30 lat_1=38d21 lat_2=37d13 lat_0=36d40 +x_0=500000 y_0=3000000 +no_defs <> + +# 4400: vermont ---: nad83 +<4400> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-72d30 lat_0=42d30 k=.9999642857142857 +x_0=500000 y_0=0 +no_defs <> + +# 4501: virginia north: nad83 +<4501> proj=lcc a=6378137 es=.0066943800229 +lon_0=-78d30 lat_1=39d12 lat_2=38d2 lat_0=37d40 +x_0=3500000 y_0=2000000 +no_defs <> + +# 4502: virginia south: nad83 +<4502> proj=lcc a=6378137 es=.0066943800229 +lon_0=-78d30 lat_1=37d58 lat_2=36d46 lat_0=36d20 +x_0=3500000 y_0=1000000 +no_defs <> + +# 4601: washington north: nad83 +<4601> proj=lcc a=6378137 es=.0066943800229 +lon_0=-120d50 lat_1=48d44 lat_2=47d30 lat_0=47 +x_0=500000 y_0=0 +no_defs <> + +# 4602: washington south: nad83 +<4602> proj=lcc a=6378137 es=.0066943800229 +lon_0=-120d30 lat_1=47d20 lat_2=45d50 lat_0=45d20 +x_0=500000 y_0=0 +no_defs <> + +# 4701: west virginia north: nad83 +<4701> proj=lcc a=6378137 es=.0066943800229 +lon_0=-79d30 lat_1=40d15 lat_2=39 lat_0=38d30 +x_0=600000 y_0=0 +no_defs <> + +# 4702: west virginia south: nad83 +<4702> proj=lcc a=6378137 es=.0066943800229 +lon_0=-81 lat_1=38d53 lat_2=37d29 lat_0=37 +x_0=600000 y_0=0 +no_defs <> + +# 4801: wisconsin north: nad83 +<4801> proj=lcc a=6378137 es=.0066943800229 +lon_0=-90 lat_1=46d46 lat_2=45d34 lat_0=45d10 +x_0=600000 y_0=0 +no_defs <> + +# 4802: wisconsin central: nad83 +<4802> proj=lcc a=6378137 es=.0066943800229 +lon_0=-90 lat_1=45d30 lat_2=44d15 lat_0=43d50 +x_0=600000 y_0=0 +no_defs <> + +# 4803: wisconsin south: nad83 +<4803> proj=lcc a=6378137 es=.0066943800229 +lon_0=-90 lat_1=44d4 lat_2=42d44 lat_0=42 +x_0=600000 y_0=0 +no_defs <> + +# 4901: wyoming east: nad83 +<4901> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-105d10 lat_0=40d30 k=.9999375 +x_0=200000 y_0=0 +no_defs <> + +# 4902: wyoming east central: nad83 +<4902> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-107d20 lat_0=40d30 k=.9999375 +x_0=400000 y_0=100000 +no_defs <> + +# 4903: wyoming west central: nad83 +<4903> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-108d45 lat_0=40d30 k=.9999375 +x_0=600000 y_0=0 +no_defs <> + +# 4904: wyoming west: nad83 +<4904> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-110d5 lat_0=40d30 k=.9999375 +x_0=800000 y_0=100000 +no_defs <> + +# 5001: alaska zone no. 1: nad83 +<5001> proj=omerc a=6378137 es=.0066943800229 +k=.9999 lonc=-133d40 lat_0=57 alpha=-36d52'11.6315 +x_0=818676.7344011233 y_0=575097.6888751927 +no_defs <> + +# 5002: alaska zone no. 2: nad83 +<5002> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-142 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5003: alaska zone no. 3: nad83 +<5003> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-146 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5004: alaska zone no. 4: nad83 +<5004> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-150 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5005: alaska zone no. 5: nad83 +<5005> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-154 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5006: alaska zone no. 6: nad83 +<5006> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-158 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5007: alaska zone no. 7: nad83 +<5007> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-162 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5008: alaska zone no. 8: nad83 +<5008> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-166 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5009: alaska zone no. 9: nad83 +<5009> proj=tmerc a=6378137 es=.0066943800229 +lon_0=-170 lat_0=54 k=.9999 +x_0=500000 y_0=0 +no_defs <> + +# 5200: puerto rico and virgin islands: nad83 +<5200> proj=lcc a=6378137 es=.0066943800229 +lon_0=-66d26 lat_1=18d26 lat_2=18d2 lat_0=17d50 +x_0=200000 y_0=200000 +no_defs <> + diff --git a/nad/pj_out27.dist b/nad/pj_out27.dist new file mode 100644 index 00000000..632dfc62 --- /dev/null +++ b/nad/pj_out27.dist @@ -0,0 +1,265 @@ + -134d00'00.000 55d00'00.000 2615716.535 1156768.938 2615716.535 1156768.938 AK 1 GP1 + -133d40'00.000 57d00'00.000 2685642.815 1887198.473 2685642.815 1887198.473 AK 1 GP2 + -131d35'45.432 54d39'02.654 3124247.971 1035731.647 3124247.971 1035731.647 AK 1 GP3 + -129d32'30.000 54d32'30.000 3561180.429 1015414.284 3561180.429 1015414.284 AK 1 GP4 + -141d30'00.000 60d30'00.000 1275974.313 3248584.184 1275974.313 3248584.184 AK 1 GP6 + -142d00'00.000 56d30'30.000 500000.000 916085.508 500000.000 916085.508 AK 2 GP1 + -146d00'00.000 56d30'30.000 500000.000 916085.508 500000.000 916085.508 AK 3 GP1 + -150d00'00.000 56d30'30.000 500000.000 916085.508 500000.000 916085.508 AK 4 GP1 + -152d28'56.134 60d53'28.765 770312.640 2520850.030 770312.640 2520850.031 AK 5 GP1 + -154d00'00.000 56d30'30.000 500000.000 916085.508 500000.000 916085.508 AK 5 GP2 + -155d00'00.000 71d00'00.000 857636.168 6224356.319 857636.168 6224356.320 AK 6 GP1 + -158d00'00.000 71d00'00.000 500000.000 6215501.077 500000.000 6215501.078 AK 6 GP1 + -162d00'00.000 65d15'00.000 700000.000 4111525.685 700000.000 4111525.687 AK 7 GP1 + -166d00'00.000 65d15'00.000 500000.000 4111525.685 500000.000 4111525.687 AK 8 GP1 + -170d00'00.000 63d20'00.000 600000.000 3410550.007 600000.000 3410550.008 AK 9 GP1 + -164d02'30.000 54d27'30.000 5533424.392 1473805.123 5533424.392 1473805.123 AK10 GP1 + -176d00'00.000 52d30'00.000 3000000.000 547583.333 3000000.000 547583.333 AK10 GP2 + -85d50'00.000 31d20'00.000 500000.000 303093.746 500000.000 303093.746 AL E GP1 + -85d12'41.738 32d38'57.737 691376.573 782394.791 691376.573 782394.791 AL E GP2 + -86d36'58.670 34d48'58.708 264979.900 1571249.667 264979.900 1571249.667 AL E GP3 + -87d30'00.000 33d20'00.000 500000.000 1212487.425 500000.000 1212487.425 AL W GP1 + -87d30'00.000 33d20'30.000 500000.000 1215519.455 500000.000 1215519.455 AL W GP2 + -91d34'46.321 35d18'37.443 2125448.748 355890.988 2125448.748 355890.988 AR N GP1 + -92d04'11.625 35d19'34.269 1979150.162 361375.766 1979150.162 361375.766 AR N GP2 + -92d00'00.000 34d45'00.000 2000000.000 758096.040 2000000.000 758096.040 AR S GP1 + -92d00'00.000 33d15'00.000 2000000.000 212263.845 2000000.000 212263.845 AR S GP2 + -170d00'00.000 -14d16'00.000 500000.000 312234.650 500000.000 312234.650 AS GP1 + -166d50'38.406 -9d34'41.556 1640416.676 2007870.029 1640416.676 2007870.029 AS GP2 + -111d55'00.000 34d45'00.000 500000.000 1364267.386 500000.000 1364267.386 AZ C GP1 + -111d55'00.000 32d20'00.000 500000.000 484978.270 500000.000 484978.270 AZ C GP2 + -110d24'59.771 35d09'58.568 425301.125 1515853.425 425301.125 1515853.426 AZ E GP1 + -109d34'33.127 31d59'53.103 683147.830 363527.538 683147.830 363527.538 AZ E GP2 + -110d30'34.948 35d07'28.243 397422.297 1500739.241 397422.297 1500739.241 AZ E GP3 + -109d45'13.226 32d08'41.778 627823.092 416691.532 627823.092 416691.532 AZ E GP4 + -113d45'00.000 34d45'00.000 500000.000 1364312.866 500000.000 1364312.866 AZ W GP1 + -113d45'00.000 34d45'30.000 500000.000 1367345.603 500000.000 1367345.603 AZ W GP2 + -113d45'00.000 34d46'00.000 500000.000 1370378.345 500000.000 1370378.345 AZ W GP3 + -122d00'00.000 41d30'00.000 2000000.000 789314.699 2000000.000 789314.699 CA 1 GP1 + -122d00'00.000 41d30'30.000 2000000.000 792351.052 2000000.000 792351.052 CA 1 GP2 + -122d00'00.000 39d20'00.000 2000000.000 606975.074 2000000.000 606975.074 CA 2 GP1 + -122d00'00.000 39d20'30.000 2000000.000 610010.158 2000000.000 610010.158 CA 2 GP2 + -120d30'00.000 37d05'00.000 2000000.000 212394.029 2000000.000 212394.029 CA 3 GP1 + -121d22'26.019 37d30'30.324 1746516.910 368350.900 1746516.910 368350.900 CA 3 GP2 + -119d46'32.733 37d07'41.470 2211146.746 229541.692 2211146.746 229541.692 CA 3 GP3 + -119d38'26.434 36d55'48.009 2251190.696 157720.169 2251190.696 157720.169 CA 3 GP4 + -120d42'59.779 38d06'52.815 1937681.203 587984.757 1937681.203 587984.757 CA 3 GP5 + -119d00'00.000 36d20'00.000 2000000.000 364036.106 2000000.000 364036.106 CA 4 GP1 + -119d00'00.000 36d20'30.000 2000000.000 367069.711 2000000.000 367069.711 CA 4 GP2 + -118d00'00.000 34d45'00.000 2000000.000 454894.032 2000000.000 454894.032 CA 5 GP1 + -118d00'00.000 34d45'30.000 2000000.000 457926.735 2000000.000 457926.735 CA 5 GP2 + -116d15'00.000 33d20'00.000 2000000.000 424481.703 2000000.000 424481.703 CA 6 GP1 + -116d15'00.000 33d20'30.000 2000000.000 427513.796 2000000.000 427513.796 CA 6 GP2 + -118d20'00.000 34d30'00.000 4186692.580 4294365.712 4186692.580 4294365.712 CA 7 GP1 + -105d30'00.000 39d15'00.000 2000000.000 515936.228 2000000.000 515936.228 CO C GP1 + -105d30'00.000 39d15'30.000 2000000.000 518971.313 2000000.000 518971.313 CO C GP2 + -108d45'55.378 40d25'33.504 1091086.832 414752.176 1091086.832 414752.176 CO N GP1 + -105d14'45.588 40d12'42.711 2070940.652 320120.166 2070940.652 320120.166 CO N GP2 + -105d30'00.000 37d30'00.000 2000000.000 303425.100 2000000.000 303425.100 CO S GP1 + -105d30'00.000 37d30'30.000 2000000.000 306459.335 2000000.000 306459.335 CO S GP2 + -72d43'30.515 41d16'55.847 606832.139 163540.219 606832.139 163540.219 CT GP1 + -73d01'15.609 41d13'25.985 525446.203 142415.891 525446.203 142415.891 CT GP2 + -75d33'00.748 39d21'15.214 462235.881 493228.846 462235.881 493228.846 DE GP1 + -75d19'01.889 39d45'14.765 527969.596 638870.822 527969.596 638870.822 DE GP2 + -80d11'00.000 25d45'00.000 768810.056 515637.939 768810.056 515637.939 FL E GP1 + -82d45'52.412 29d39'06.589 2551254.254 241240.008 2551254.254 241240.008 FL N GP1 + -84d55'11.533 29d38'51.982 1866620.008 235814.655 1866620.008 235814.655 FL N GP2 + -82d38'00.000 27d47'00.000 295216.148 1254408.638 295216.148 1254408.638 FL W GP1 + -81d27'15.592 32d38'03.003 719287.314 958818.262 719287.314 958818.262 GA E GP1 + -83d15'39.990 33d29'58.626 166361.311 1274706.363 166361.311 1274706.363 GA E GP2 + -84d23'00.000 33d45'00.000 434141.824 1364117.672 434141.824 1364117.672 GA W GP1 + 144d44'55.503 13d28'20.879 164041.712 164041.680 164041.712 164041.680 GU GP1 + 144d38'07.193 13d20'20.538 123728.401 115623.086 123728.401 115623.086 GU GP2 + -155d59'16.911 19d37'23.477 332050.939 287068.342 332050.939 287068.342 HI 1 GP1 + -155d18'06.262 19d31'24.578 568270.061 250663.241 568270.061 250663.241 HI 1 GP2 + -155d30'00.000 19d42'00.000 500000.000 314722.985 500000.000 314722.985 HI 1 GP3 + -155d30'00.000 19d42'30.000 500000.000 317749.315 500000.000 317749.315 HI 1 GP4 + -156d40'00.000 20d42'00.000 500000.000 133170.903 500000.000 133170.903 HI 2 GP1 + -156d40'00.000 20d42'30.000 500000.000 136197.580 500000.000 136197.580 HI 2 GP2 + -158d00'00.000 21d30'00.000 500000.000 121078.981 500000.000 121078.981 HI 3 GP1 + -158d01'30.000 21d37'30.000 491508.215 166485.537 491508.215 166485.537 HI 3 GP2 + -159d30'00.000 22d05'00.000 500000.000 90816.138 500000.000 90816.138 HI 4 GP1 + -160d10'00.000 21d42'00.000 500000.000 12108.532 500000.000 12108.532 HI 5 GP1 + -93d28'33.966 42d44'50.101 2006419.316 454523.076 2006419.316 454523.076 IA N GP1 + -93d54'22.084 42d40'23.699 1890779.351 427816.212 1890779.351 427816.212 IA N GP2 + -93d37'00.000 41d35'00.000 1968081.762 576880.709 1968081.762 576880.709 IA S GP1 + -114d24'00.000 42d56'00.000 392878.009 461838.231 392878.009 461838.231 ID C GP1 + -111d42'29.824 43d48'07.616 621017.480 778569.749 621017.480 778569.749 ID E GP1 + -112d22'35.516 43d35'26.260 444398.356 701217.958 444398.356 701217.958 ID E GP2 + -116d22'02.592 48d07'50.941 349231.302 2357247.272 349231.302 2357247.272 ID W GP1 + -88d07'06.790 41d46'11.855 558591.507 1858801.531 558591.507 1858801.531 IL E GP1 + -88d41'35.208 40d43'37.202 400279.755 1478930.010 400279.755 1478930.010 IL E GP2 + -90d10'00.000 38d30'00.000 500000.000 667527.020 500000.000 667527.020 IL W GP1 + -85d40'00.000 40d00'00.000 500000.000 910470.785 500000.000 910470.786 IN E GP1 + -85d40'00.000 40d00'30.000 500000.000 913506.350 500000.000 913506.351 IN E GP2 + -86d14'27.780 40d00'12.690 339087.973 912273.324 339087.973 912273.325 IN E GP3 + -86d14'27.790 40d00'31.660 339099.565 914192.836 339099.565 914192.836 IN E GP4 + -86d14'28.103 40d00'47.412 339085.485 915786.883 339085.485 915786.883 IN E GP6 + -87d05'00.000 40d00'00.000 500000.000 910470.785 500000.000 910470.786 IN W GP1 + -87d05'00.000 40d00'30.000 500000.000 913506.350 500000.000 913506.351 IN W GP2 + -86d45'10.717 39d41'24.840 592969.921 797807.077 592969.921 797807.077 IN W GP3 + -87d41'44.075 37d54'24.755 323351.583 148732.658 323351.583 148732.658 IN W GP4 + -86d32'13.179 39d32'46.419 654071.692 745650.467 654071.692 745650.467 IN W GP5 + -87d25'26.675 38d26'17.646 402398.078 341828.410 402398.078 341828.410 IN W GP6 + -86d14'28.103 40d00'47.412 735905.989 916383.007 735905.989 916383.007 IN W GP7 + -86d14'27.780 40d00'12.690 735964.329 912869.812 735964.329 912869.812 IN W GP8 + -86d14'27.790 40d00'31.660 735945.409 914789.331 735945.409 914789.331 IN W GP9 + -96d47'54.567 38d58'52.096 2341555.463 238196.375 2341555.463 238196.375 KS N GP1 + -98d35'23.954 39d58'41.967 1834645.786 599682.614 1834645.786 599682.614 KS N GP2 + -97d21'00.000 37d42'00.000 2332714.529 378302.303 2332714.529 378302.303 KS S GP1 + -84d05'43.283 38d14'35.963 2044414.776 270720.831 2044414.776 270720.831 KY N GP1 + -84d26'49.265 39d04'03.099 1944057.054 570906.807 1944057.054 570906.807 KY N GP2 + -86d05'00.000 37d10'00.000 1902871.440 303569.007 1902871.440 303569.007 KY S GP1 + -91d34'46.483 31d57'26.243 2285456.159 470671.781 2285456.159 470671.781 LA N GP1 + -92d52'46.615 32d54'52.264 1883486.181 817905.853 1883486.181 817905.853 LA N GP2 + -91d29'09.480 31d56'44.721 2314527.078 466735.568 2314527.078 466735.568 LA N GP3 + -93d59'38.241 32d48'43.467 1540965.776 783590.902 1540965.776 783590.902 LA N GP4 + -89d00'00.000 28d50'00.000 2747176.527 68218.410 2747176.527 68218.410 LA S GP1 + -89d30'00.000 28d50'00.000 2587082.796 65307.429 2587082.796 65307.429 LA S GP2 + -89d29'59.999 29d19'59.994 2584173.994 247106.020 2584173.994 247106.020 LA S GP3 + -89d00'00.004 29d19'59.998 2743474.038 250002.972 2743474.038 250002.972 LA S GP4 + -89d10'23.487 29d20'32.615 2688234.966 252215.035 2688234.966 252215.035 LA S GP5 + -89d06'34.632 29d15'19.642 2709099.980 220994.973 2709099.980 220994.973 LA S GP6 + -89d01'33.803 29d07'47.918 2736661.987 175901.967 2736661.987 175901.967 LA S GP7 + -89d08'45.781 28d58'27.979 2699434.976 118600.021 2699434.976 118600.021 LA S GP9 + -70d30'00.000 41d30'00.000 200000.000 182180.613 200000.000 182180.613 MA I GP1 + -70d27'00.716 41d40'15.808 886823.958 246295.510 886823.958 246295.510 MA M GP1 + -73d25'59.173 42d06'06.860 75432.106 407473.253 75432.106 407473.253 MA M GP2 + -76d11'27.492 39d12'06.132 1029272.677 499353.154 1029272.677 499353.154 MD GP1 + -77d02'30.406 38d26'37.492 788033.549 222300.512 788033.549 222300.512 MD GP2 + -77d30'10.460 38d59'25.903 657055.715 421819.661 657055.715 421819.661 MD GP3 + -68d24'25.489 46d32'46.920 523379.868 989125.403 523379.868 989125.403 ME E GP1 + -68d37'29.366 47d02'12.659 468876.638 1168006.571 468876.638 1168006.571 ME E GP2 + -70d16'00.000 43d40'00.000 473538.933 303746.300 473538.933 303746.300 ME W GP1 + -85d40'00.000 44d45'00.000 1653612.784 525406.529 1653612.784 525406.529 MI C GP1 + -83d29'17.919 42d19'19.299 2228532.810 300724.433 2228532.810 300724.433 MI S GP1 + -83d35'24.656 42d20'02.682 2200944.119 304856.048 2200944.119 304856.048 MI S GP2 + -85d55'26.569 41d50'10.236 1566471.427 126614.633 1566471.427 126614.633 MI S GP3 + -85d45'59.490 41d49'22.346 1609315.113 120996.336 1609315.113 120996.336 MI S GP4 + -89d20'00.000 46d50'00.000 353999.488 1944621.410 353999.488 1944621.410 MI W GP1 + -91d27'51.183 47d08'19.177 2407087.310 237254.364 2407087.310 237254.364 MN N GP1 + -95d51'05.998 48d19'26.552 1330690.998 677229.560 1330690.998 677229.560 MN N GP2 + -92d30'00.000 38d15'00.000 500000.000 879833.618 500000.000 879833.618 MO C GP1 + -92d30'00.000 38d15'30.000 500000.000 882868.158 500000.000 882868.158 MO C GP2 + -91d42'04.297 37d22'05.932 150919.587 561018.126 150919.587 561018.127 MO E GP1 + -90d08'08.896 36d53'44.124 606497.861 386893.306 606497.861 386893.306 MO E GP2 + -94d30'00.000 38d15'00.000 500000.000 758504.732 500000.000 758504.732 MO W GP1 + -94d30'00.000 38d15'30.000 500000.000 761539.296 500000.000 761539.296 MO W GP2 + -89d10'14.013 30d30'51.338 393805.810 308399.629 393805.810 308399.629 MS E GP1 + -88d26'04.338 30d43'01.454 625321.316 382224.788 625321.316 382224.788 MS E GP2 + -90d10'00.000 32d17'00.000 551507.962 648697.041 551507.962 648697.041 MS W GP1 + -109d25'00.000 47d05'00.000 2020760.609 455889.692 2020760.609 455889.692 MT C GP1 + -106d29'11.521 47d52'21.103 2739443.845 332808.759 2739443.845 332808.759 MT N GP1 + -114d30'43.122 48d52'46.764 794693.447 725072.329 794693.447 725072.329 MT N GP2 + -109d15'00.000 45d39'00.000 2063931.561 601700.560 2063931.561 601700.560 MT S GP1 + -81d12'31.790 35d09'31.049 1339854.041 519988.737 1339854.041 519988.737 NC GP1 + -76d31'54.918 35d33'51.452 2733941.071 669408.798 2733941.071 669408.798 NC GP2 + -78d28'26.580 36d15'15.480 2155088.262 911860.343 2155088.262 911860.343 NC GP3 + -98d46'03.232 48d08'13.483 2422983.823 419525.823 2422983.823 419525.823 ND N GP1 + -101d18'21.456 47d39'18.935 1801367.700 240053.997 1801367.700 240053.997 ND N GP2 + -100d46'00.000 46d48'00.000 1933213.911 413422.204 1933213.911 413422.204 ND S GP1 + -96d17'52.930 42d04'48.305 3004688.243 293978.208 3004688.243 293978.208 NE N GP1 + -100d49'26.949 41d58'54.025 1775916.042 237340.591 1775916.042 237340.591 NE N GP2 + -96d43'00.000 40d49'00.000 2770252.364 431225.617 2770252.364 431225.617 NE S GP1 + -70d56'11.287 43d08'15.006 694907.496 233185.793 694907.496 233185.793 NH GP1 + -72d32'32.197 42d51'25.984 265213.564 131404.574 265213.564 131404.574 NH GP2 + -74d13'55.737 39d52'02.095 2121971.499 376878.657 2121971.499 376878.657 NJ GP1 + -74d51'24.058 41d12'07.401 1947709.569 862915.876 1947709.569 862915.876 NJ GP2 + -106d15'00.000 33d30'00.000 500000.000 909419.295 500000.000 909419.295 NM C GP1 + -106d15'00.000 33d30'30.000 500000.000 912451.306 500000.000 912451.306 NM C GP2 + -104d11'42.410 33d17'21.732 542236.924 832820.301 542236.924 832820.301 NM E GP1 + -104d47'37.948 33d22'32.349 359406.535 864495.731 359406.535 864495.732 NM E GP2 + -107d50'00.000 32d30'00.000 500000.000 545616.897 500000.000 545616.897 NM W GP1 + -107d50'00.000 32d30'30.000 500000.000 548648.466 500000.000 548648.466 NM W GP2 + -116d48'00.000 36d58'00.000 461048.286 806858.042 461048.286 806858.042 NV C GP1 + -114d49'09.337 35d43'09.299 726805.224 353637.053 726805.224 353637.053 NV E GP1 + -116d50'32.766 41d30'37.869 155162.931 2464191.578 155162.931 2464191.579 NV E GP2 + -119d49'00.000 39d32'00.000 152145.548 1743820.923 152145.548 1743820.924 NV W GP1 + -76d10'00.000 43d05'00.000 611313.134 1123706.620 611313.134 1123706.621 NY C GP1 + -74d02'53.671 42d17'01.775 577147.690 832219.885 577147.690 832219.885 NY E GP1 + -74d44'39.818 42d30'07.382 389148.814 911884.889 389148.814 911884.889 NY E GP2 + -73d02'36.247 40d47'50.624 2264860.626 209793.919 2264860.626 209793.919 NY L GP1 + -74d06'58.125 40d36'07.281 1967746.807 137190.013 1967746.807 137190.013 NY L GP2 + -74d00'00.000 40d45'00.000 2000000.000 191080.202 2000000.000 191080.202 NY L GP3 + -73d15'00.000 40d37'30.000 2208197.581 146431.086 2208197.581 146431.086 NY L GP4 + -73d22'30.000 40d45'00.000 2173173.707 191697.996 2173173.707 191697.996 NY L GP5 + -78d51'00.000 42d54'00.000 428547.567 1056727.674 428547.567 1056727.674 NY W GP1 + -80d49'28.238 40d17'50.894 2467363.986 234305.751 2467363.986 234305.751 OH N GP1 + -82d37'31.021 40d20'14.678 1965071.932 244391.910 1965071.932 244391.910 OH N GP2 + -84d15'00.000 39d45'00.000 1507970.925 642141.152 1507970.925 642141.152 OH S GP1 + -98d42'45.414 36d50'19.568 1791448.615 670119.442 1791448.615 670119.442 OK N GP1 + -95d38'44.046 35d20'36.925 2702176.218 133585.952 2702176.218 133585.952 OK N GP2 + -97d08'00.000 34d34'00.000 2260914.787 449942.599 2260914.787 449942.599 OK S GP1 + -123d41'00.000 45d31'00.000 1184216.898 690530.257 1184216.898 690530.257 OR N GP1 + -119d46'26.562 44d24'25.943 2189746.353 999672.239 2189746.353 999672.239 OR S GP1 + -121d09'56.105 44d23'08.924 1825970.576 991740.899 1825970.576 991740.899 OR S GP2 + -74d33'20.644 41d23'48.566 2876202.339 464358.775 2876202.339 464358.775 PA N GP1 + -78d09'48.121 40d51'35.455 1885652.438 252829.477 1885652.438 252829.477 PA N GP2 + -67d08'56.930 18d29'56.972 251990.753 242253.319 251990.753 242253.319 PR F GP1 + -66d52'30.000 18d15'00.000 346756.548 151479.295 346756.548 151479.295 PR F GP2 + -66d26'00.000 18d15'00.000 500000.000 151294.491 500000.000 151294.491 PR F GP3 + -66d26'00.000 18d30'00.000 500000.000 242074.012 500000.000 242074.012 PR F GP4 + -67d08'56.930 18d29'56.972 251990.753 242253.319 251990.753 242253.319 PR M GP1 + -66d52'30.000 18d15'00.000 346756.548 151479.295 346756.548 151479.295 PR M GP2 + -66d26'00.000 18d15'00.000 500000.000 151294.491 500000.000 151294.491 PR M GP3 + -66d26'00.000 18d30'00.000 500000.000 242074.012 500000.000 242074.012 PR M GP4 + -64d43'00.000 17d40'00.000 1097602.972 42283.509 1097602.972 42283.509 PS S GP1 + -71d16'00.833 41d32'24.848 563817.074 166563.592 563817.074 166563.592 RI GP1 + -71d37'13.730 41d23'53.266 466943.554 114721.079 466943.554 114721.079 RI GP2 + -80d32'30.000 34d32'30.000 2138028.224 561330.721 2138028.224 561330.721 SC N GP1 + -81d00'00.000 34d32'30.000 2000000.000 561019.077 2000000.000 561019.077 SC N GP2 + -80d32'30.000 33d32'30.000 2139661.529 621836.603 2139661.529 621836.603 SC S GP1 + -81d00'00.000 33d32'30.000 2000000.000 621532.356 2000000.000 621532.356 SC S GP2 + -99d12'21.983 44d06'08.121 2208566.880 99065.808 2208566.880 99065.808 SD N GP1 + -100d32'28.873 44d32'34.917 1858852.206 259207.243 1858852.206 259207.243 SD N GP2 + -103d14'00.000 44d06'00.000 1238344.555 657205.595 1238344.555 657205.595 SD S GP1 + -85d13'55.967 36d21'48.503 2226074.895 718522.870 2226074.895 718522.870 TN GP1 + -88d43'05.849 36d30'08.410 1201097.659 779285.593 1201097.659 779285.593 TN GP2 + -97d06'00.000 31d35'00.000 3006704.541 711708.204 3006704.541 711708.204 TX C GP1 + -100d33'06.303 34d39'35.684 2285173.373 241550.390 2285173.373 241550.390 TX N GP1 + -102d48'50.949 34d43'39.249 1605118.921 267430.718 1605118.921 267430.718 TX N GP2 + -97d30'00.000 25d55'00.000 2328727.194 92175.721 2328727.194 92175.721 TX S GP1 + -96d48'00.000 32d45'00.000 2215204.973 394833.169 2215204.973 394833.169 TXNC GP1 + -98d30'00.000 29d25'00.000 2159176.237 576022.948 2159176.237 576022.948 TXSC GP1 + -111d30'00.000 38d40'00.000 2000000.000 121415.345 2000000.000 121415.345 UT C GP1 + -111d30'00.000 38d40'30.000 2000000.000 124450.619 2000000.000 124450.619 UT C GP2 + -111d30'00.000 41d30'00.000 2000000.000 425057.445 2000000.000 425057.445 UT N GP1 + -111d30'00.000 41d30'30.000 2000000.000 428093.810 2000000.000 428093.810 UT N GP2 + -109d48'37.967 38d29'30.877 2483568.472 668988.098 2483568.472 668988.098 UT S GP1 + -113d52'56.922 37d09'18.788 1305706.243 186731.606 1305706.243 186731.606 UT S GP2 + -77d13'46.945 38d55'12.407 2361415.621 458962.786 2361415.621 458962.786 VA N GP1 + -79d18'51.557 38d09'59.020 1765875.433 183017.881 1765875.433 183017.881 VA N GP2 + -77d38'10.823 37d49'23.964 2249484.834 58221.695 2249484.834 58221.695 VA N GP3 + -79d26'19.475 37d47'25.852 1728704.621 46487.604 1728704.621 46487.604 VA N GP4 + -77d44'30.336 39d00'06.804 2215488.016 487135.448 2215488.016 487135.448 VA N GP6 + -77d43'47.013 38d59'55.454 2218917.620 486015.701 2218917.620 486015.701 VA N GP9 + -78d30'00.000 37d30'00.000 2000000.000 424763.516 2000000.000 424763.516 VA S GP1 + -78d30'00.000 37d30'30.000 2000000.000 427797.710 2000000.000 427797.710 VA S GP2 + -77d32'33.000 36d54'42.507 2279939.213 212030.192 2279939.213 212030.192 VA S GP3 + -77d21'55.732 38d04'53.901 2326572.191 638519.064 2326572.191 638519.064 VA S GP4 + -64d45'30.000 17d45'30.000 1082794.001 75432.552 1082794.001 75432.552 VI F GP1 + -66d26'00.000 17d45'56.426 500000.000 75432.505 500000.000 75432.505 VI F GP2 + -64d45'30.000 17d45'30.000 1082794.001 75432.552 1082794.001 75432.552 VI M GP1 + -66d26'00.000 17d45'56.426 500000.000 75432.505 500000.000 75432.505 VI M GP2 + -72d29'31.418 43d09'58.526 502118.227 242816.621 502118.227 242816.621 VT GP1 + -73d12'06.978 44d22'22.810 316451.963 683472.660 316451.963 683472.660 VT GP2 + -119d51'37.006 47d50'51.069 2238927.196 310658.148 2238927.196 310658.148 WA N GP1 + -123d59'49.087 48d09'29.131 1228043.506 438306.777 1228043.506 438306.777 WA N GP2 + -122d54'00.000 46d09'00.000 1391814.257 307059.945 1391814.257 307059.945 WA S GP1 + -88d04'00.000 44d30'00.000 2504399.560 249042.105 2504399.560 249042.105 WI C GP1 + -88d44'40.778 45d22'21.598 2322632.765 77666.151 2322632.765 77666.151 WI N GP1 + -92d12'19.275 45d48'35.812 1437681.450 242373.846 1437681.450 242373.846 WI N GP2 + -89d23'00.000 43d05'00.000 2164743.544 395445.420 2164743.544 395445.420 WI S GP1 + -77d53'39.269 39d14'39.339 2454764.840 275139.246 2454764.840 275139.246 WV N GP1 + -81d33'23.549 39d18'08.535 1418073.862 298900.611 1418073.862 298900.611 WV N GP2 + -77d30'10.460 38d59'25.903 2567632.286 184970.946 2567632.286 184970.946 WV N GP3 + -105d07'00.000 44d38'00.000 513016.009 1445570.354 513016.009 1445570.355 WY E GP1 + -105d31'02.882 43d30'40.600 406937.677 1036750.417 406937.677 1036750.418 WY E GP1 + -105d22'42.856 43d30'14.685 443778.141 1034002.062 443778.141 1034002.062 WY E GP2 + -105d28'42.827 43d36'33.391 417392.389 1072428.186 417392.389 1072428.186 WY E GP3 + -105d23'43.223 42d00'59.422 437860.186 491889.060 437860.186 491889.060 WY E GP4 + -104d35'06.686 42d34'50.366 656606.905 697923.643 656606.905 697923.643 WY E GP5 + -110d36'00.000 41d48'00.000 359125.204 413338.815 359125.204 413338.815 WY W GP1 + -106d13'03.224 41d36'14.640 805153.891 343496.745 805153.891 343496.746 WYEC GP1 + -108d01'56.720 41d51'57.518 309581.204 437731.262 309581.204 437731.262 WYEC GP2 + -108d24'00.000 43d02'00.000 593579.361 862553.590 593579.361 862553.590 WYWC GP1 diff --git a/nad/pj_out83.dist b/nad/pj_out83.dist new file mode 100644 index 00000000..726140f3 --- /dev/null +++ b/nad/pj_out83.dist @@ -0,0 +1,225 @@ + -134d00'00.000 55d00'00.000 2616018.154 1156379.643 2616018.154 1156379.643 AK 1 GP1 + -133d40'00.000 57d00'00.000 2685941.919 1886799.668 2685941.919 1886799.668 AK 1 GP2 + -131d35'45.432 54d39'02.654 3124531.426 1035343.511 3124531.426 1035343.511 AK 1 GP3 + -129d32'30.000 54d32'30.000 3561448.345 1015025.876 3561448.345 1015025.876 AK 1 GP4 + -141d30'00.000 60d30'00.000 1276328.587 3248159.207 1276328.587 3248159.207 AK 1 GP6 + -142d00'00.000 56d30'30.000 1640416.667 916074.824 1640416.667 916074.825 AK 2 GP1 + -146d00'00.000 56d30'30.000 1640416.667 916074.824 1640416.667 916074.825 AK 3 GP1 + -150d00'00.000 56d30'30.000 1640416.667 916074.824 1640416.667 916074.825 AK 4 GP1 + -152d28'56.134 60d53'28.765 1910718.662 2520810.679 1910718.662 2520810.680 AK 5 GP1 + -154d00'00.000 56d30'30.000 1640416.667 916074.824 1640416.667 916074.825 AK 5 GP2 + -155d00'00.000 71d00'00.000 1998036.998 6224208.215 1998036.998 6224208.217 AK 6 GP1 + -158d00'00.000 71d00'00.000 1640416.667 6215353.365 1640416.667 6215353.367 AK 6 GP1 + -162d00'00.000 65d15'00.000 1640416.667 4111446.440 1640416.667 4111446.441 AK 7 GP1 + -166d00'00.000 65d15'00.000 1640416.667 4111446.440 1640416.667 4111446.441 AK 8 GP1 + -170d00'00.000 63d20'00.000 1640416.667 3410489.716 1640416.667 3410489.717 AK 9 GP1 + -164d02'30.000 54d27'30.000 5814167.604 1473788.834 5814167.604 1473788.834 AK10 GP1 + -176d00'00.000 52d30'00.000 3280833.333 547580.542 3280833.333 547580.542 AK10 GP2 + -85d50'00.000 31d20'00.000 656166.667 303104.183 656166.667 303104.183 AL E GP1 + -85d12'41.738 32d38'57.737 847539.085 782420.807 847539.085 782420.807 AL E GP2 + -86d36'58.670 34d48'58.708 421151.975 1571298.908 421151.975 1571298.908 AL E GP3 + -87d30'00.000 33d20'00.000 1968500.000 1212527.586 1968500.000 1212527.587 AL W GP1 + -87d30'00.000 33d20'30.000 1968500.000 1215559.708 1968500.000 1215559.708 AL W GP2 + -91d34'46.321 35d18'37.443 1437779.156 355900.759 1437779.156 355900.759 AR N GP1 + -92d04'11.625 35d19'34.269 1291483.982 361385.695 1291483.982 361385.695 AR N GP2 + -92d00'00.000 34d45'00.000 1312333.333 2070451.744 1312333.333 2070451.744 AR S GP1 + -92d00'00.000 33d15'00.000 1312333.333 1524603.730 1312333.333 1524603.730 AR S GP2 + -111d55'00.000 34d45'00.000 699998.600 1364309.666 699998.600 1364309.666 AZ C GP1 + -111d55'00.000 32d20'00.000 699998.600 484994.340 699998.600 484994.340 AZ C GP2 + -110d24'59.771 35d09'58.568 625301.460 1515899.830 625301.460 1515899.830 AZ E GP1 + -109d34'33.127 31d59'53.103 883142.524 363539.663 883142.524 363539.663 AZ E GP2 + -110d30'34.948 35d07'28.243 597423.277 1500785.234 597423.277 1500785.235 AZ E GP3 + -109d45'13.226 32d08'41.778 827818.955 416705.394 827818.955 416705.394 AZ E GP4 + -113d45'00.000 34d45'00.000 699998.600 1364355.147 699998.600 1364355.147 AZ W GP1 + -113d45'00.000 34d45'30.000 699998.600 1367387.968 699998.600 1367387.968 AZ W GP2 + -113d45'00.000 34d46'00.000 699998.600 1370420.793 699998.600 1370420.793 AZ W GP3 + -122d00'00.000 41d30'00.000 6561666.667 2429744.729 6561666.667 2429744.729 CA 1 GP1 + -122d00'00.000 41d30'30.000 6561666.667 2432781.128 6561666.667 2432781.128 CA 1 GP2 + -122d00'00.000 39d20'00.000 6561666.667 2247404.250 6561666.667 2247404.250 CA 2 GP1 + -122d00'00.000 39d20'30.000 6561666.667 2250439.391 6561666.667 2250439.391 CA 2 GP2 + -120d30'00.000 37d05'00.000 6561666.667 1852815.760 6561666.667 1852815.760 CA 3 GP1 + -121d22'26.019 37d30'30.324 6308189.835 2008776.145 6308189.835 2008776.145 CA 3 GP2 + -119d46'32.733 37d07'41.470 6772808.251 1869963.783 6772808.251 1869963.783 CA 3 GP3 + -119d38'26.434 36d55'48.009 6812851.254 1798140.563 6812851.254 1798140.563 CA 3 GP4 + -120d42'59.779 38d06'52.815 6499349.432 2228414.867 6499349.432 2228414.867 CA 3 GP5 + -119d00'00.000 36d20'00.000 6561666.667 2004462.102 6561666.667 2004462.102 CA 4 GP1 + -119d00'00.000 36d20'30.000 6561666.667 2007495.782 6561666.667 2007495.782 CA 4 GP2 + -118d00'00.000 34d45'00.000 6561666.667 2095323.781 6561666.667 2095323.781 CA 5 GP1 + -118d00'00.000 34d45'30.000 6561666.667 2098356.568 6561666.667 2098356.568 CA 5 GP2 + -116d15'00.000 33d20'00.000 6561666.667 2064911.626 6561666.667 2064911.626 CA 6 GP1 + -116d15'00.000 33d20'30.000 6561666.667 2067943.810 6561666.667 2067943.810 CA 6 GP2 + -118d20'00.000 34d30'00.000 5933874.572 2495758.727 5933874.572 2495758.727 CA 7 GP1 + -105d30'00.000 39d15'00.000 3000000.000 1515946.820 3000000.000 1515946.820 CO C GP1 + -105d30'00.000 39d15'30.000 3000000.000 1518981.963 3000000.000 1518981.963 CO C GP2 + -108d45'55.378 40d25'33.504 2091110.958 1414758.884 2091110.958 1414758.884 CO N GP1 + -105d14'45.588 40d12'42.711 3070938.779 1320125.979 3070938.779 1320125.979 CO N GP2 + -105d30'00.000 37d30'00.000 3000000.000 1303432.168 3000000.000 1303432.168 CO S GP1 + -105d30'00.000 37d30'30.000 3000000.000 1306466.471 3000000.000 1306466.471 CO S GP2 + -72d43'30.515 41d16'55.847 1006831.954 663542.786 1006831.954 663542.786 CT GP1 + -73d01'15.609 41d13'25.985 925448.220 642418.129 925448.220 642418.129 CT GP2 + -75d33'00.748 39d21'15.214 618403.524 493238.843 618403.524 493238.843 DE GP1 + -75d19'01.889 39d45'14.765 684135.532 638883.528 684135.532 638883.528 DE GP2 + -82d45'52.412 29d39'06.589 2519743.236 241248.726 2519743.236 241248.726 FL N GP1 + -84d55'11.533 29d38'51.982 1835122.674 235823.399 1835122.674 235823.399 FL N GP2 + -81d27'15.592 32d38'03.003 875449.222 958850.568 875449.222 958850.568 GA E GP1 + -83d15'39.990 33d29'58.626 322535.391 1274748.301 322535.391 1274748.301 GA E GP2 + -155d59'16.911 19d37'23.477 1472470.137 287083.198 1472470.137 287083.198 HI 1 GP1 + -155d18'06.262 19d31'24.578 1708685.701 250676.240 1708685.701 250676.240 HI 1 GP2 + -155d30'00.000 19d42'00.000 1640416.667 314739.275 1640416.667 314739.275 HI 1 GP3 + -155d30'00.000 19d42'30.000 1640416.667 317765.760 1640416.667 317765.760 HI 1 GP4 + -156d40'00.000 20d42'00.000 1640416.667 133177.588 1640416.667 133177.588 HI 2 GP1 + -156d40'00.000 20d42'30.000 1640416.667 136204.417 1640416.667 136204.417 HI 2 GP2 + -158d00'00.000 21d30'00.000 1640416.667 121084.931 1640416.667 121084.931 HI 3 GP1 + -158d01'30.000 21d37'30.000 1631925.017 166493.704 1631925.017 166493.704 HI 3 GP2 + -159d30'00.000 22d05'00.000 1640416.667 90820.525 1640416.667 90820.525 HI 4 GP1 + -160d10'00.000 21d42'00.000 1640416.667 12109.121 1640416.667 12109.121 HI 5 GP1 + -93d28'33.966 42d44'50.101 4927669.136 3735362.601 4927669.136 3735362.601 IA N GP1 + -93d54'22.084 42d40'23.699 4812032.409 3708655.393 4812032.409 3708655.393 IA N GP2 + -111d42'29.824 43d48'07.616 777180.670 778579.414 777180.670 778579.414 ID E GP1 + -112d22'35.516 43d35'26.260 600566.613 701226.817 600566.613 701226.817 ID E GP2 + -116d22'02.592 48d07'50.941 2473902.726 2357266.576 2473902.726 2357266.577 ID W GP1 + -88d07'06.790 41d46'11.855 1042839.901 1858837.259 1042839.901 1858837.259 IL E GP1 + -88d41'35.208 40d43'37.202 884532.422 1478959.911 884532.422 1478959.912 IL E GP2 + -85d40'00.000 40d00'00.000 328083.333 1730697.447 328083.333 1730697.447 IN E GP1 + -85d40'00.000 40d00'30.000 328083.333 1733733.065 328083.333 1733733.066 IN E GP2 + -86d14'27.780 40d00'12.690 167175.533 1732499.995 167175.533 1732499.995 IN E GP3 + -86d14'27.790 40d00'31.660 167187.126 1734419.540 167187.126 1734419.540 IN E GP4 + -86d14'28.103 40d00'47.412 167173.047 1736013.615 167173.047 1736013.616 IN E GP6 + -87d05'00.000 40d00'00.000 2952750.000 1730697.447 2952750.000 1730697.447 IN W GP1 + -87d05'00.000 40d00'30.000 2952750.000 1733733.065 2952750.000 1733733.066 IN W GP2 + -86d45'10.717 39d41'24.840 3045717.498 1618031.699 3045717.498 1618031.699 IN W GP3 + -87d41'44.075 37d54'24.755 2776105.988 968944.255 2776105.988 968944.255 IN W GP4 + -86d32'13.179 39d32'46.419 3106817.690 1565874.112 3106817.690 1565874.113 IN W GP5 + -87d25'26.675 38d26'17.646 2855150.544 1162044.125 2855150.544 1162044.125 IN W GP6 + -86d14'28.103 40d00'47.412 3188649.790 1736609.724 3188649.790 1736609.724 IN W GP7 + -86d14'27.780 40d00'12.690 3188708.130 1733096.467 3188708.130 1733096.467 IN W GP8 + -86d14'27.790 40d00'31.660 3188689.210 1735016.020 3188689.210 1735016.020 IN W GP9 + -96d47'54.567 38d58'52.096 1653880.047 238201.110 1653880.047 238201.110 KS N GP1 + -98d35'23.954 39d58'41.967 1146983.460 599694.197 1146983.460 599694.197 KS N GP2 + -84d05'43.283 38d14'35.963 1684830.325 270726.733 1684830.325 270726.733 KY N GP1 + -84d26'49.265 39d04'03.099 1584475.157 570918.805 1584475.157 570918.805 KY N GP2 + -91d34'46.483 31d57'26.243 3566283.410 531318.874 3566283.410 531318.874 LA N GP1 + -92d52'46.615 32d54'52.264 3164322.062 878564.036 3164322.062 878564.036 LA N GP2 + -91d29'09.480 31d56'44.721 3595353.711 527382.519 3595353.711 527382.519 LA N GP3 + -93d59'38.241 32d48'43.467 2821809.119 844247.864 2821809.119 844247.864 LA N GP4 + -89d00'00.000 28d50'00.000 4027995.272 128836.330 4027995.272 128836.330 LA S GP1 + -89d30'00.000 28d50'00.000 3867904.667 125925.406 3867904.667 125925.406 LA S GP2 + -89d29'59.999 29d19'59.994 3864995.756 307730.820 3864995.756 307730.820 LA S GP3 + -89d00'00.004 29d19'59.998 4024292.645 310627.715 4024292.645 310627.715 LA S GP4 + -89d10'23.487 29d20'32.615 3969054.663 312839.922 3969054.663 312839.922 LA S GP5 + -89d06'34.632 29d15'19.642 3989919.298 281618.678 3989919.298 281618.678 LA S GP6 + -89d01'33.803 29d07'47.918 4017480.813 236523.957 4017480.813 236523.957 LA S GP7 + -89d08'45.781 28d58'27.979 3980254.597 179219.900 3980254.597 179219.900 LA S GP9 + -70d27'00.716 41d40'15.808 942982.782 2706924.168 942982.782 2706924.168 MA M GP1 + -73d25'59.173 42d06'06.860 131613.265 2868104.007 131613.265 2868104.007 MA M GP2 + -76d11'27.492 39d12'06.132 1541600.105 560062.872 1541600.105 560062.872 MD GP1 + -77d02'30.406 38d26'37.492 1300367.185 283004.738 1300367.185 283004.738 MD GP2 + -77d30'10.460 38d59'25.903 1169392.711 482527.897 1169392.711 482527.897 MD GP3 + -68d24'25.489 46d32'46.920 1007629.154 1049880.999 1007629.154 1049880.999 ME E GP1 + -68d37'29.366 47d02'12.659 953127.598 1228762.971 953127.598 1228762.971 ME E GP2 + -83d29'17.919 42d19'19.299 13360865.013 300809.378 13360865.013 300809.378 MI S GP1 + -83d35'24.656 42d20'02.682 13333276.507 304929.978 13333276.507 304929.978 MI S GP2 + -85d55'26.569 41d50'10.236 12698916.149 126441.631 12698916.149 126441.631 MI S GP3 + -85d45'59.490 41d49'22.346 12741759.240 120840.463 12741759.240 120840.463 MI S GP4 + -91d27'51.183 47d08'19.177 3031741.394 565338.600 3031741.394 565338.600 MN N GP1 + -95d51'05.998 48d19'26.552 1955378.869 1005314.701 1955378.869 1005314.701 MN N GP2 + -92d30'00.000 38d15'00.000 1640416.667 879854.176 1640416.667 879854.176 MO C GP1 + -92d30'00.000 38d15'30.000 1640416.667 882888.780 1640416.667 882888.780 MO C GP2 + -91d42'04.297 37d22'05.932 471136.507 561031.592 471136.507 561031.592 MO E GP1 + -90d08'08.896 36d53'44.124 926703.606 386902.829 926703.606 386902.829 MO E GP2 + -94d30'00.000 38d15'00.000 2788708.333 758522.219 2788708.333 758522.219 MO W GP1 + -94d30'00.000 38d15'30.000 2788708.333 761556.846 2788708.333 761556.846 MO W GP2 + -89d10'14.013 30d30'51.338 878059.046 369015.468 878059.046 369015.468 MS E GP1 + -88d26'04.338 30d43'01.454 1109567.483 442842.466 1109567.483 442842.466 MS E GP2 + -106d29'11.521 47d52'21.103 2707564.623 1334850.273 2707564.623 1334850.273 MT N GP1 + -114d30'43.122 48d52'46.764 763315.457 1726511.247 763315.457 1726511.247 MT N GP2 + -81d12'31.790 35d09'31.049 1339869.379 520003.003 1339869.379 520003.003 NC GP1 + -76d31'54.918 35d33'51.452 2733923.842 669426.932 2733923.842 669426.932 NC GP2 + -78d28'26.580 36d15'15.480 2155084.559 911885.081 2155084.559 911885.081 NC GP3 + -98d46'03.232 48d08'13.483 2391470.474 419526.909 2391470.474 419526.909 ND N GP1 + -101d18'21.456 47d39'18.935 1769873.906 240054.790 1769873.906 240054.790 ND N GP2 + -96d17'52.930 42d04'48.305 2644820.409 839912.565 2644820.409 839912.565 NE N GP1 + -100d49'26.949 41d58'54.025 1416403.828 783622.046 1416403.828 783622.046 NE N GP2 + -70d56'11.287 43d08'15.006 1179151.981 233188.619 1179151.981 233188.620 NH GP1 + -72d32'32.197 42d51'25.984 749470.166 131406.173 749470.166 131406.173 NH GP2 + -74d13'55.737 39d52'02.095 567304.543 376673.733 567304.543 376673.733 NJ GP1 + -74d51'24.058 41d12'07.401 393979.614 863010.549 393979.614 863010.549 NJ GP2 + -106d15'00.000 33d30'00.000 1640416.667 909448.493 1640416.667 909448.493 NM C GP1 + -106d15'00.000 33d30'30.000 1640416.667 912480.595 1640416.667 912480.595 NM C GP2 + -104d11'42.410 33d17'21.732 583573.491 832847.194 583573.491 832847.194 NM E GP1 + -104d47'37.948 33d22'32.349 400747.149 864523.566 400747.149 864523.566 NM E GP2 + -107d50'00.000 32d30'00.000 2723091.667 545634.896 2723091.667 545634.896 NM W GP1 + -107d50'00.000 32d30'30.000 2723091.667 548666.562 2723091.667 548666.562 NM W GP2 + -114d49'09.337 35d43'09.299 882966.545 26600313.129 882966.545 26600313.129 NV E GP1 + -116d50'32.766 41d30'37.869 311338.993 28710910.564 311338.993 28710910.565 NV E GP2 + -74d02'53.671 42d17'01.775 614362.369 1257287.611 614362.369 1257287.611 NY E GP1 + -74d44'39.818 42d30'07.382 426225.275 1336579.561 426225.275 1336579.561 NY E GP2 + -73d02'36.247 40d47'50.624 1249103.533 231235.845 1249103.533 231235.845 NY L GP1 + -74d06'58.125 40d36'07.281 951997.667 158630.811 951997.667 158630.811 NY L GP2 + -74d00'00.000 40d45'00.000 984250.000 212521.887 984250.000 212521.887 NY L GP3 + -73d15'00.000 40d37'30.000 1192442.028 167871.999 1192442.028 167871.999 NY L GP4 + -73d22'30.000 40d45'00.000 1157419.074 213139.664 1157419.074 213139.664 NY L GP5 + -80d49'28.238 40d17'50.894 2435851.621 234309.717 2435851.621 234309.717 OH N GP1 + -82d37'31.021 40d20'14.678 1933572.857 244396.244 1933572.857 244396.244 OH N GP2 + -98d42'45.414 36d50'19.568 1759953.675 670136.468 1759953.675 670136.468 OK N GP1 + -95d38'44.046 35d20'36.925 2670659.833 133589.112 2670659.833 133589.112 OK N GP2 + -119d46'26.562 44d24'25.943 5110990.827 999684.042 5110990.827 999684.042 OR S GP1 + -121d09'56.105 44d23'08.924 4747225.642 991752.635 4747225.642 991752.635 OR S GP2 + -74d33'20.644 41d23'48.566 2844678.533 464365.610 2844678.533 464365.610 PA N GP1 + -78d09'48.121 40d51'35.455 1854155.505 252833.700 1854155.505 252833.700 PA N GP2 + -67d08'56.930 18d29'56.972 408161.046 898432.808 408161.046 898432.808 PR F GP1 + -66d52'30.000 18d15'00.000 502925.440 807654.009 502925.440 807654.009 PR F GP2 + -66d26'00.000 18d15'00.000 656166.667 807469.207 656166.667 807469.207 PR F GP3 + -66d26'00.000 18d30'00.000 656166.667 898253.524 656166.667 898253.524 PR F GP4 + -67d08'56.930 18d29'56.972 408161.046 898432.808 408161.046 898432.808 PR M GP1 + -66d52'30.000 18d15'00.000 502925.440 807654.009 502925.440 807654.009 PR M GP2 + -66d26'00.000 18d15'00.000 656166.667 807469.207 656166.667 807469.207 PR M GP3 + -66d26'00.000 18d30'00.000 656166.667 898253.524 656166.667 898253.524 PR M GP4 + -71d16'00.833 41d32'24.848 391898.667 166566.121 391898.667 166566.121 RI GP1 + -71d37'13.730 41d23'53.266 295027.785 114722.837 295027.785 114722.837 RI GP2 + -80d32'30.000 34d32'30.000 2138015.480 985710.127 2138015.480 985710.127 SC N GP1 + -81d00'00.000 34d32'30.000 1999996.000 985404.077 1999996.000 985404.077 SC N GP2 + -80d32'30.000 33d32'30.000 2139629.138 621856.156 2139629.138 621856.156 SC S GP1 + -81d00'00.000 33d32'30.000 1999996.000 621546.527 1999996.000 621546.527 SC S GP2 + -99d12'21.983 44d06'08.121 2177060.848 99066.761 2177060.848 99066.761 SD N GP1 + -100d32'28.873 44d32'34.917 1827356.330 259209.712 1827356.330 259209.712 SD N GP2 + -85d13'55.967 36d21'48.503 2194569.476 739881.374 2194569.476 739881.374 TN GP1 + -88d43'05.849 36d30'08.410 1169616.875 800645.091 1169616.875 800645.091 TN GP2 + -100d33'06.303 34d39'35.684 941333.504 3522390.511 941333.504 3522390.511 TX N GP1 + -102d48'50.949 34d43'39.249 261294.654 3548271.494 261294.654 3548271.494 TX N GP2 + -111d30'00.000 38d40'00.000 1640416.667 6683084.515 1640416.667 6683084.515 UT C GP1 + -111d30'00.000 38d40'30.000 1640416.667 6686119.851 1640416.667 6686119.851 UT C GP2 + -111d30'00.000 41d30'00.000 1640416.667 3705897.565 1640416.667 3705897.565 UT N GP1 + -111d30'00.000 41d30'30.000 1640416.667 3708933.975 1640416.667 3708933.975 UT N GP2 + -109d48'37.967 38d29'30.877 2123972.902 10511502.846 2123972.902 10511502.846 UT S GP1 + -113d52'56.922 37d09'18.788 946139.893 10029235.592 946139.893 10029235.592 UT S GP2 + -77d13'46.945 38d55'12.407 11844323.043 7020638.975 11844323.043 7020638.975 VA N GP1 + -79d18'51.557 38d09'59.020 11248797.976 6744688.474 11248797.976 6744688.474 VA N GP2 + -77d38'10.823 37d49'23.964 11732395.294 6619889.590 11732395.294 6619889.590 VA N GP3 + -79d26'19.475 37d47'25.852 11211628.032 6608155.232 11211628.032 6608155.232 VA N GP4 + -77d44'30.336 39d00'06.804 11698399.159 7048812.266 11698399.159 7048812.266 VA N GP6 + -77d43'47.013 38d59'55.454 11701828.676 7047692.496 11701828.676 7047692.496 VA N GP9 + -78d30'00.000 37d30'00.000 11482916.667 3705606.876 11482916.667 3705606.876 VA S GP1 + -78d30'00.000 37d30'30.000 11482916.667 3708641.137 11482916.667 3708641.137 VA S GP2 + -77d32'33.000 36d54'42.507 11762849.074 3492868.579 11762849.074 3492868.579 VA S GP3 + -77d21'55.732 38d04'53.901 11809480.679 3919367.025 11809480.679 3919367.025 VA S GP4 + -64d45'30.000 17d45'30.000 1238952.313 631597.723 1238952.313 631597.723 VI F GP1 + -66d26'00.000 17d45'56.426 656166.667 631597.858 656166.667 631597.858 VI F GP2 + -64d45'30.000 17d45'30.000 1238952.313 631597.723 1238952.313 631597.723 VI M GP1 + -66d26'00.000 17d45'56.426 656166.667 631597.858 656166.667 631597.858 VI M GP2 + -72d29'31.418 43d09'58.526 1642534.834 242819.594 1642534.834 242819.594 VT GP1 + -73d12'06.978 44d22'22.810 1456873.971 683480.189 1456873.971 683480.189 VT GP2 + -119d51'37.006 47d50'51.069 1879336.368 310659.110 1879336.368 310659.110 WA N GP1 + -123d59'49.087 48d09'29.131 868484.545 438307.526 868484.545 438307.526 WA N GP2 + -88d44'40.778 45d22'21.598 2291123.165 77666.637 2291123.165 77666.637 WI N GP1 + -92d12'19.275 45d48'35.812 1406198.343 242375.264 1406198.343 242375.264 WI N GP2 + -77d53'39.269 39d14'39.339 2423253.113 275144.536 2423253.113 275144.536 WV N GP1 + -81d33'23.549 39d18'08.535 1386588.889 298906.239 1386588.889 298906.239 WV N GP2 + -77d30'10.460 38d59'25.903 2536117.742 184974.384 2536117.742 184974.384 WV N GP3 + -105d31'02.882 43d30'40.600 563107.342 1097477.489 563107.342 1097477.489 WY E GP1 + -105d22'42.856 43d30'14.685 599946.619 1094729.118 599946.619 1094729.119 WY E GP2 + -105d28'42.827 43d36'33.391 573561.723 1133155.513 573561.723 1133155.514 WY E GP3 + -105d23'43.223 42d00'59.422 594028.794 552611.396 594028.794 552611.396 WY E GP4 + -104d35'06.686 42d34'50.366 812768.620 758647.940 812768.620 758647.940 WY E GP5 + -106d13'03.224 41d36'14.640 1617477.770 732300.770 1617477.770 732300.770 WYEC GP1 + -108d01'56.720 41d51'57.518 1121920.469 826536.345 1121920.469 826536.345 WYEC GP2 diff --git a/nad/proj_def.dat b/nad/proj_def.dat new file mode 100644 index 00000000..d91fc9b6 --- /dev/null +++ b/nad/proj_def.dat @@ -0,0 +1,17 @@ +# Projection library defaults file +# SCCSID--- @(#)proj_def.dat 4.3 94/02/23 GIE REL" +# very preliminary version +<general> +ellps=clrk66 # ellipsoid most compatible with older U.S. maps +<> +<aea> # Conterminous U.S. map +lat_1=29.5 +lat_2=45.5 +<> +<lcc> # Conterminous U.S. map +lat_1=33 +lat_2=45 +<> +<lagrng> +W=2 +<> diff --git a/nad/test27 b/nad/test27 new file mode 100755 index 00000000..4adb061a --- /dev/null +++ b/nad/test27 @@ -0,0 +1,821 @@ +: +# Script to test most of the SPCS zones. +# +# This script generated from execution of NMD's program l176, where +# the second pair of numbers are respective easting and northing output. +# +# Proj will vary in the .001ft range with projections using Transverse +# Mercator due to greater precision of meridinal distance function. +# +OUT=proj_out27 +# +echo "doing tests into file ${OUT}, please wait" +# +../src/proj +units=us-ft +init=./nad27:5001 -E -f '%.3f' >${OUT} <<EOF + -134d00'00.000 55d00'00.000 2615716.535 1156768.938 AK 1 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5001 -E -f '%.3f' >>${OUT} <<EOF + -133d40'00.000 57d00'00.000 2685642.815 1887198.473 AK 1 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5001 -E -f '%.3f' >>${OUT} <<EOF + -131d35'45.432 54d39'02.654 3124247.971 1035731.647 AK 1 GP3 +EOF +../src/proj +units=us-ft +init=./nad27:5001 -E -f '%.3f' >>${OUT} <<EOF + -129d32'30.000 54d32'30.000 3561180.429 1015414.284 AK 1 GP4 +EOF +../src/proj +units=us-ft +init=./nad27:5001 -E -f '%.3f' >>${OUT} <<EOF + -141d30'00.000 60d30'00.000 1275974.313 3248584.184 AK 1 GP6 +EOF +../src/proj +units=us-ft +init=./nad27:5002 -E -f '%.3f' >>${OUT} <<EOF + -142d00'00.000 56d30'30.000 500000.000 916085.508 AK 2 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5003 -E -f '%.3f' >>${OUT} <<EOF + -146d00'00.000 56d30'30.000 500000.000 916085.508 AK 3 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5004 -E -f '%.3f' >>${OUT} <<EOF + -150d00'00.000 56d30'30.000 500000.000 916085.508 AK 4 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5005 -E -f '%.3f' >>${OUT} <<EOF + -152d28'56.134 60d53'28.765 770312.640 2520850.031 AK 5 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5005 -E -f '%.3f' >>${OUT} <<EOF + -154d00'00.000 56d30'30.000 500000.000 916085.508 AK 5 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5006 -E -f '%.3f' >>${OUT} <<EOF + -155d00'00.000 71d00'00.000 857636.168 6224356.320 AK 6 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5006 -E -f '%.3f' >>${OUT} <<EOF + -158d00'00.000 71d00'00.000 500000.000 6215501.078 AK 6 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5007 -E -f '%.3f' >>${OUT} <<EOF + -162d00'00.000 65d15'00.000 700000.000 4111525.687 AK 7 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5008 -E -f '%.3f' >>${OUT} <<EOF + -166d00'00.000 65d15'00.000 500000.000 4111525.687 AK 8 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5009 -E -f '%.3f' >>${OUT} <<EOF + -170d00'00.000 63d20'00.000 600000.000 3410550.008 AK 9 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5010 -E -f '%.3f' >>${OUT} <<EOF + -164d02'30.000 54d27'30.000 5533424.392 1473805.123 AK10 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5010 -E -f '%.3f' >>${OUT} <<EOF + -176d00'00.000 52d30'00.000 3000000.000 547583.333 AK10 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:101 -E -f '%.3f' >>${OUT} <<EOF + -85d50'00.000 31d20'00.000 500000.000 303093.746 AL E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:101 -E -f '%.3f' >>${OUT} <<EOF + -85d12'41.738 32d38'57.737 691376.573 782394.791 AL E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:101 -E -f '%.3f' >>${OUT} <<EOF + -86d36'58.670 34d48'58.708 264979.900 1571249.667 AL E GP3 +EOF +../src/proj +units=us-ft +init=./nad27:102 -E -f '%.3f' >>${OUT} <<EOF + -87d30'00.000 33d20'00.000 500000.000 1212487.425 AL W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:102 -E -f '%.3f' >>${OUT} <<EOF + -87d30'00.000 33d20'30.000 500000.000 1215519.455 AL W GP2 +EOF +../src/proj +units=us-ft +init=./nad27:301 -E -f '%.3f' >>${OUT} <<EOF + -91d34'46.321 35d18'37.443 2125448.748 355890.988 AR N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:301 -E -f '%.3f' >>${OUT} <<EOF + -92d04'11.625 35d19'34.269 1979150.162 361375.766 AR N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:302 -E -f '%.3f' >>${OUT} <<EOF + -92d00'00.000 34d45'00.000 2000000.000 758096.040 AR S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:302 -E -f '%.3f' >>${OUT} <<EOF + -92d00'00.000 33d15'00.000 2000000.000 212263.845 AR S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5300 -E -f '%.3f' >>${OUT} <<EOF + -170d00'00.000 -14d16'00.000 500000.000 312234.650 AS GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5300 -E -f '%.3f' >>${OUT} <<EOF + -166d50'38.406 -9d34'41.556 1640416.676 2007870.029 AS GP2 +EOF +../src/proj +units=us-ft +init=./nad27:202 -E -f '%.3f' >>${OUT} <<EOF + -111d55'00.000 34d45'00.000 500000.000 1364267.386 AZ C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:202 -E -f '%.3f' >>${OUT} <<EOF + -111d55'00.000 32d20'00.000 500000.000 484978.270 AZ C GP2 +EOF +../src/proj +units=us-ft +init=./nad27:201 -E -f '%.3f' >>${OUT} <<EOF + -110d24'59.771 35d09'58.568 425301.125 1515853.426 AZ E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:201 -E -f '%.3f' >>${OUT} <<EOF + -109d34'33.127 31d59'53.103 683147.830 363527.538 AZ E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:201 -E -f '%.3f' >>${OUT} <<EOF + -110d30'34.948 35d07'28.243 397422.297 1500739.241 AZ E GP3 +EOF +../src/proj +units=us-ft +init=./nad27:201 -E -f '%.3f' >>${OUT} <<EOF + -109d45'13.226 32d08'41.778 627823.092 416691.532 AZ E GP4 +EOF +../src/proj +units=us-ft +init=./nad27:203 -E -f '%.3f' >>${OUT} <<EOF + -113d45'00.000 34d45'00.000 500000.000 1364312.866 AZ W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:203 -E -f '%.3f' >>${OUT} <<EOF + -113d45'00.000 34d45'30.000 500000.000 1367345.603 AZ W GP2 +EOF +../src/proj +units=us-ft +init=./nad27:203 -E -f '%.3f' >>${OUT} <<EOF + -113d45'00.000 34d46'00.000 500000.000 1370378.345 AZ W GP3 +EOF +../src/proj +units=us-ft +init=./nad27:401 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 41d30'00.000 2000000.000 789314.699 CA 1 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:401 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 41d30'30.000 2000000.000 792351.052 CA 1 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:402 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 39d20'00.000 2000000.000 606975.074 CA 2 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:402 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 39d20'30.000 2000000.000 610010.158 CA 2 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:403 -E -f '%.3f' >>${OUT} <<EOF + -120d30'00.000 37d05'00.000 2000000.000 212394.029 CA 3 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:403 -E -f '%.3f' >>${OUT} <<EOF + -121d22'26.019 37d30'30.324 1746516.910 368350.900 CA 3 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:403 -E -f '%.3f' >>${OUT} <<EOF + -119d46'32.733 37d07'41.470 2211146.746 229541.692 CA 3 GP3 +EOF +../src/proj +units=us-ft +init=./nad27:403 -E -f '%.3f' >>${OUT} <<EOF + -119d38'26.434 36d55'48.009 2251190.696 157720.169 CA 3 GP4 +EOF +../src/proj +units=us-ft +init=./nad27:403 -E -f '%.3f' >>${OUT} <<EOF + -120d42'59.779 38d06'52.815 1937681.203 587984.757 CA 3 GP5 +EOF +../src/proj +units=us-ft +init=./nad27:404 -E -f '%.3f' >>${OUT} <<EOF + -119d00'00.000 36d20'00.000 2000000.000 364036.106 CA 4 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:404 -E -f '%.3f' >>${OUT} <<EOF + -119d00'00.000 36d20'30.000 2000000.000 367069.711 CA 4 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:405 -E -f '%.3f' >>${OUT} <<EOF + -118d00'00.000 34d45'00.000 2000000.000 454894.032 CA 5 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:405 -E -f '%.3f' >>${OUT} <<EOF + -118d00'00.000 34d45'30.000 2000000.000 457926.735 CA 5 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:406 -E -f '%.3f' >>${OUT} <<EOF + -116d15'00.000 33d20'00.000 2000000.000 424481.703 CA 6 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:406 -E -f '%.3f' >>${OUT} <<EOF + -116d15'00.000 33d20'30.000 2000000.000 427513.796 CA 6 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:407 -E -f '%.3f' >>${OUT} <<EOF + -118d20'00.000 34d30'00.000 4186692.580 4294365.712 CA 7 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:502 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 39d15'00.000 2000000.000 515936.228 CO C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:502 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 39d15'30.000 2000000.000 518971.313 CO C GP2 +EOF +../src/proj +units=us-ft +init=./nad27:501 -E -f '%.3f' >>${OUT} <<EOF + -108d45'55.378 40d25'33.504 1091086.832 414752.176 CO N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:501 -E -f '%.3f' >>${OUT} <<EOF + -105d14'45.588 40d12'42.711 2070940.652 320120.166 CO N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:503 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 37d30'00.000 2000000.000 303425.100 CO S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:503 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 37d30'30.000 2000000.000 306459.335 CO S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:600 -E -f '%.3f' >>${OUT} <<EOF + -72d43'30.515 41d16'55.847 606832.139 163540.219 CT GP1 +EOF +../src/proj +units=us-ft +init=./nad27:600 -E -f '%.3f' >>${OUT} <<EOF + -73d01'15.609 41d13'25.985 525446.203 142415.891 CT GP2 +EOF +../src/proj +units=us-ft +init=./nad27:700 -E -f '%.3f' >>${OUT} <<EOF + -75d33'00.748 39d21'15.214 462235.881 493228.846 DE GP1 +EOF +../src/proj +units=us-ft +init=./nad27:700 -E -f '%.3f' >>${OUT} <<EOF + -75d19'01.889 39d45'14.765 527969.596 638870.822 DE GP2 +EOF +../src/proj +units=us-ft +init=./nad27:901 -E -f '%.3f' >>${OUT} <<EOF + -80d11'00.000 25d45'00.000 768810.056 515637.939 FL E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:903 -E -f '%.3f' >>${OUT} <<EOF + -82d45'52.412 29d39'06.589 2551254.254 241240.008 FL N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:903 -E -f '%.3f' >>${OUT} <<EOF + -84d55'11.533 29d38'51.982 1866620.008 235814.655 FL N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:902 -E -f '%.3f' >>${OUT} <<EOF + -82d38'00.000 27d47'00.000 295216.148 1254408.638 FL W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1001 -E -f '%.3f' >>${OUT} <<EOF + -81d27'15.592 32d38'03.003 719287.314 958818.262 GA E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1001 -E -f '%.3f' >>${OUT} <<EOF + -83d15'39.990 33d29'58.626 166361.311 1274706.363 GA E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1002 -E -f '%.3f' >>${OUT} <<EOF + -84d23'00.000 33d45'00.000 434141.824 1364117.672 GA W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5400 -E -f '%.3f' >>${OUT} <<EOF + 144d44'55.503 13d28'20.879 164041.712 164041.680 GU GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5400 -E -f '%.3f' >>${OUT} <<EOF + 144d38'07.193 13d20'20.538 123728.401 115623.086 GU GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d59'16.911 19d37'23.477 332050.939 287068.342 HI 1 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d18'06.262 19d31'24.578 568270.061 250663.241 HI 1 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d30'00.000 19d42'00.000 500000.000 314722.985 HI 1 GP3 +EOF +../src/proj +units=us-ft +init=./nad27:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d30'00.000 19d42'30.000 500000.000 317749.315 HI 1 GP4 +EOF +../src/proj +units=us-ft +init=./nad27:5102 -E -f '%.3f' >>${OUT} <<EOF + -156d40'00.000 20d42'00.000 500000.000 133170.903 HI 2 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5102 -E -f '%.3f' >>${OUT} <<EOF + -156d40'00.000 20d42'30.000 500000.000 136197.580 HI 2 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5103 -E -f '%.3f' >>${OUT} <<EOF + -158d00'00.000 21d30'00.000 500000.000 121078.981 HI 3 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5103 -E -f '%.3f' >>${OUT} <<EOF + -158d01'30.000 21d37'30.000 491508.215 166485.537 HI 3 GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5104 -E -f '%.3f' >>${OUT} <<EOF + -159d30'00.000 22d05'00.000 500000.000 90816.138 HI 4 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5105 -E -f '%.3f' >>${OUT} <<EOF + -160d10'00.000 21d42'00.000 500000.000 12108.532 HI 5 GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1401 -E -f '%.3f' >>${OUT} <<EOF + -93d28'33.966 42d44'50.101 2006419.316 454523.076 IA N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1401 -E -f '%.3f' >>${OUT} <<EOF + -93d54'22.084 42d40'23.699 1890779.351 427816.212 IA N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1402 -E -f '%.3f' >>${OUT} <<EOF + -93d37'00.000 41d35'00.000 1968081.762 576880.709 IA S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1102 -E -f '%.3f' >>${OUT} <<EOF + -114d24'00.000 42d56'00.000 392878.009 461838.231 ID C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1101 -E -f '%.3f' >>${OUT} <<EOF + -111d42'29.824 43d48'07.616 621017.480 778569.749 ID E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1101 -E -f '%.3f' >>${OUT} <<EOF + -112d22'35.516 43d35'26.260 444398.356 701217.958 ID E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1103 -E -f '%.3f' >>${OUT} <<EOF + -116d22'02.592 48d07'50.941 349231.302 2357247.272 ID W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1201 -E -f '%.3f' >>${OUT} <<EOF + -88d07'06.790 41d46'11.855 558591.507 1858801.531 IL E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1201 -E -f '%.3f' >>${OUT} <<EOF + -88d41'35.208 40d43'37.202 400279.755 1478930.010 IL E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1202 -E -f '%.3f' >>${OUT} <<EOF + -90d10'00.000 38d30'00.000 500000.000 667527.020 IL W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1301 -E -f '%.3f' >>${OUT} <<EOF + -85d40'00.000 40d00'00.000 500000.000 910470.786 IN E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1301 -E -f '%.3f' >>${OUT} <<EOF + -85d40'00.000 40d00'30.000 500000.000 913506.351 IN E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1301 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.780 40d00'12.690 339087.973 912273.325 IN E GP3 +EOF +../src/proj +units=us-ft +init=./nad27:1301 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.790 40d00'31.660 339099.565 914192.836 IN E GP4 +EOF +../src/proj +units=us-ft +init=./nad27:1301 -E -f '%.3f' >>${OUT} <<EOF + -86d14'28.103 40d00'47.412 339085.485 915786.883 IN E GP6 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d05'00.000 40d00'00.000 500000.000 910470.786 IN W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d05'00.000 40d00'30.000 500000.000 913506.351 IN W GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d45'10.717 39d41'24.840 592969.921 797807.077 IN W GP3 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d41'44.075 37d54'24.755 323351.583 148732.658 IN W GP4 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d32'13.179 39d32'46.419 654071.692 745650.467 IN W GP5 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d25'26.675 38d26'17.646 402398.078 341828.410 IN W GP6 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d14'28.103 40d00'47.412 735905.989 916383.007 IN W GP7 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.780 40d00'12.690 735964.329 912869.812 IN W GP8 +EOF +../src/proj +units=us-ft +init=./nad27:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.790 40d00'31.660 735945.409 914789.331 IN W GP9 +EOF +../src/proj +units=us-ft +init=./nad27:1501 -E -f '%.3f' >>${OUT} <<EOF + -96d47'54.567 38d58'52.096 2341555.463 238196.375 KS N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1501 -E -f '%.3f' >>${OUT} <<EOF + -98d35'23.954 39d58'41.967 1834645.786 599682.614 KS N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1502 -E -f '%.3f' >>${OUT} <<EOF + -97d21'00.000 37d42'00.000 2332714.529 378302.303 KS S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1601 -E -f '%.3f' >>${OUT} <<EOF + -84d05'43.283 38d14'35.963 2044414.776 270720.831 KY N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1601 -E -f '%.3f' >>${OUT} <<EOF + -84d26'49.265 39d04'03.099 1944057.054 570906.807 KY N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1602 -E -f '%.3f' >>${OUT} <<EOF + -86d05'00.000 37d10'00.000 1902871.440 303569.007 KY S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1701 -E -f '%.3f' >>${OUT} <<EOF + -91d34'46.483 31d57'26.243 2285456.159 470671.781 LA N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1701 -E -f '%.3f' >>${OUT} <<EOF + -92d52'46.615 32d54'52.264 1883486.181 817905.853 LA N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1701 -E -f '%.3f' >>${OUT} <<EOF + -91d29'09.480 31d56'44.721 2314527.078 466735.568 LA N GP3 +EOF +../src/proj +units=us-ft +init=./nad27:1701 -E -f '%.3f' >>${OUT} <<EOF + -93d59'38.241 32d48'43.467 1540965.776 783590.902 LA N GP4 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d00'00.000 28d50'00.000 2747176.527 68218.410 LA S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d30'00.000 28d50'00.000 2587082.796 65307.429 LA S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d29'59.999 29d19'59.994 2584173.994 247106.020 LA S GP3 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d00'00.004 29d19'59.998 2743474.038 250002.972 LA S GP4 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d10'23.487 29d20'32.615 2688234.966 252215.035 LA S GP5 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d06'34.632 29d15'19.642 2709099.980 220994.973 LA S GP6 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d01'33.803 29d07'47.918 2736661.987 175901.967 LA S GP7 +EOF +../src/proj +units=us-ft +init=./nad27:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d08'45.781 28d58'27.979 2699434.976 118600.021 LA S GP9 +EOF +../src/proj +units=us-ft +init=./nad27:2002 -E -f '%.3f' >>${OUT} <<EOF + -70d30'00.000 41d30'00.000 200000.000 182180.613 MA I GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2001 -E -f '%.3f' >>${OUT} <<EOF + -70d27'00.716 41d40'15.808 886823.958 246295.510 MA M GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2001 -E -f '%.3f' >>${OUT} <<EOF + -73d25'59.173 42d06'06.860 75432.106 407473.253 MA M GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1900 -E -f '%.3f' >>${OUT} <<EOF + -76d11'27.492 39d12'06.132 1029272.677 499353.154 MD GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1900 -E -f '%.3f' >>${OUT} <<EOF + -77d02'30.406 38d26'37.492 788033.549 222300.512 MD GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1900 -E -f '%.3f' >>${OUT} <<EOF + -77d30'10.460 38d59'25.903 657055.715 421819.661 MD GP3 +EOF +../src/proj +units=us-ft +init=./nad27:1801 -E -f '%.3f' >>${OUT} <<EOF + -68d24'25.489 46d32'46.920 523379.868 989125.403 ME E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:1801 -E -f '%.3f' >>${OUT} <<EOF + -68d37'29.366 47d02'12.659 468876.638 1168006.571 ME E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:1802 -E -f '%.3f' >>${OUT} <<EOF + -70d16'00.000 43d40'00.000 473538.933 303746.300 ME W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2112 -E -f '%.3f' >>${OUT} <<EOF + -85d40'00.000 44d45'00.000 1653612.784 525406.529 MI C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2113 -E -f '%.3f' >>${OUT} <<EOF + -83d29'17.919 42d19'19.299 2228532.810 300724.433 MI S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2113 -E -f '%.3f' >>${OUT} <<EOF + -83d35'24.656 42d20'02.682 2200944.119 304856.048 MI S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2113 -E -f '%.3f' >>${OUT} <<EOF + -85d55'26.569 41d50'10.236 1566471.427 126614.633 MI S GP3 +EOF +../src/proj +units=us-ft +init=./nad27:2113 -E -f '%.3f' >>${OUT} <<EOF + -85d45'59.490 41d49'22.346 1609315.113 120996.336 MI S GP4 +EOF +../src/proj +units=us-ft +init=./nad27:2103 -E -f '%.3f' >>${OUT} <<EOF + -89d20'00.000 46d50'00.000 353999.488 1944621.410 MI W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2201 -E -f '%.3f' >>${OUT} <<EOF + -91d27'51.183 47d08'19.177 2407087.310 237254.364 MN N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2201 -E -f '%.3f' >>${OUT} <<EOF + -95d51'05.998 48d19'26.552 1330690.998 677229.560 MN N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2402 -E -f '%.3f' >>${OUT} <<EOF + -92d30'00.000 38d15'00.000 500000.000 879833.618 MO C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2402 -E -f '%.3f' >>${OUT} <<EOF + -92d30'00.000 38d15'30.000 500000.000 882868.158 MO C GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2401 -E -f '%.3f' >>${OUT} <<EOF + -91d42'04.297 37d22'05.932 150919.587 561018.127 MO E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2401 -E -f '%.3f' >>${OUT} <<EOF + -90d08'08.896 36d53'44.124 606497.861 386893.306 MO E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2403 -E -f '%.3f' >>${OUT} <<EOF + -94d30'00.000 38d15'00.000 500000.000 758504.732 MO W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2403 -E -f '%.3f' >>${OUT} <<EOF + -94d30'00.000 38d15'30.000 500000.000 761539.296 MO W GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2301 -E -f '%.3f' >>${OUT} <<EOF + -89d10'14.013 30d30'51.338 393805.810 308399.629 MS E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2301 -E -f '%.3f' >>${OUT} <<EOF + -88d26'04.338 30d43'01.454 625321.316 382224.788 MS E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2302 -E -f '%.3f' >>${OUT} <<EOF + -90d10'00.000 32d17'00.000 551507.962 648697.041 MS W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2502 -E -f '%.3f' >>${OUT} <<EOF + -109d25'00.000 47d05'00.000 2020760.609 455889.692 MT C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2501 -E -f '%.3f' >>${OUT} <<EOF + -106d29'11.521 47d52'21.103 2739443.845 332808.759 MT N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2501 -E -f '%.3f' >>${OUT} <<EOF + -114d30'43.122 48d52'46.764 794693.447 725072.329 MT N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2503 -E -f '%.3f' >>${OUT} <<EOF + -109d15'00.000 45d39'00.000 2063931.561 601700.560 MT S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3200 -E -f '%.3f' >>${OUT} <<EOF + -81d12'31.790 35d09'31.049 1339854.041 519988.737 NC GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3200 -E -f '%.3f' >>${OUT} <<EOF + -76d31'54.918 35d33'51.452 2733941.071 669408.798 NC GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3200 -E -f '%.3f' >>${OUT} <<EOF + -78d28'26.580 36d15'15.480 2155088.262 911860.343 NC GP3 +EOF +../src/proj +units=us-ft +init=./nad27:3301 -E -f '%.3f' >>${OUT} <<EOF + -98d46'03.232 48d08'13.483 2422983.823 419525.823 ND N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3301 -E -f '%.3f' >>${OUT} <<EOF + -101d18'21.456 47d39'18.935 1801367.700 240053.997 ND N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3302 -E -f '%.3f' >>${OUT} <<EOF + -100d46'00.000 46d48'00.000 1933213.911 413422.204 ND S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2601 -E -f '%.3f' >>${OUT} <<EOF + -96d17'52.930 42d04'48.305 3004688.243 293978.208 NE N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2601 -E -f '%.3f' >>${OUT} <<EOF + -100d49'26.949 41d58'54.025 1775916.042 237340.591 NE N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2602 -E -f '%.3f' >>${OUT} <<EOF + -96d43'00.000 40d49'00.000 2770252.364 431225.617 NE S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2800 -E -f '%.3f' >>${OUT} <<EOF + -70d56'11.287 43d08'15.006 694907.496 233185.793 NH GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2800 -E -f '%.3f' >>${OUT} <<EOF + -72d32'32.197 42d51'25.984 265213.564 131404.574 NH GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2900 -E -f '%.3f' >>${OUT} <<EOF + -74d13'55.737 39d52'02.095 2121971.499 376878.657 NJ GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2900 -E -f '%.3f' >>${OUT} <<EOF + -74d51'24.058 41d12'07.401 1947709.569 862915.876 NJ GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3002 -E -f '%.3f' >>${OUT} <<EOF + -106d15'00.000 33d30'00.000 500000.000 909419.295 NM C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3002 -E -f '%.3f' >>${OUT} <<EOF + -106d15'00.000 33d30'30.000 500000.000 912451.306 NM C GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3001 -E -f '%.3f' >>${OUT} <<EOF + -104d11'42.410 33d17'21.732 542236.924 832820.301 NM E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3001 -E -f '%.3f' >>${OUT} <<EOF + -104d47'37.948 33d22'32.349 359406.535 864495.732 NM E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3003 -E -f '%.3f' >>${OUT} <<EOF + -107d50'00.000 32d30'00.000 500000.000 545616.897 NM W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3003 -E -f '%.3f' >>${OUT} <<EOF + -107d50'00.000 32d30'30.000 500000.000 548648.466 NM W GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2702 -E -f '%.3f' >>${OUT} <<EOF + -116d48'00.000 36d58'00.000 461048.286 806858.042 NV C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2701 -E -f '%.3f' >>${OUT} <<EOF + -114d49'09.337 35d43'09.299 726805.224 353637.053 NV E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:2701 -E -f '%.3f' >>${OUT} <<EOF + -116d50'32.766 41d30'37.869 155162.931 2464191.579 NV E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:2703 -E -f '%.3f' >>${OUT} <<EOF + -119d49'00.000 39d32'00.000 152145.548 1743820.924 NV W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3102 -E -f '%.3f' >>${OUT} <<EOF + -76d10'00.000 43d05'00.000 611313.134 1123706.621 NY C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3101 -E -f '%.3f' >>${OUT} <<EOF + -74d02'53.671 42d17'01.775 577147.690 832219.885 NY E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3101 -E -f '%.3f' >>${OUT} <<EOF + -74d44'39.818 42d30'07.382 389148.814 911884.889 NY E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3104 -E -f '%.3f' >>${OUT} <<EOF + -73d02'36.247 40d47'50.624 2264860.626 209793.919 NY L GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3104 -E -f '%.3f' >>${OUT} <<EOF + -74d06'58.125 40d36'07.281 1967746.807 137190.013 NY L GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3104 -E -f '%.3f' >>${OUT} <<EOF + -74d00'00.000 40d45'00.000 2000000.000 191080.202 NY L GP3 +EOF +../src/proj +units=us-ft +init=./nad27:3104 -E -f '%.3f' >>${OUT} <<EOF + -73d15'00.000 40d37'30.000 2208197.581 146431.086 NY L GP4 +EOF +../src/proj +units=us-ft +init=./nad27:3104 -E -f '%.3f' >>${OUT} <<EOF + -73d22'30.000 40d45'00.000 2173173.707 191697.996 NY L GP5 +EOF +../src/proj +units=us-ft +init=./nad27:3103 -E -f '%.3f' >>${OUT} <<EOF + -78d51'00.000 42d54'00.000 428547.567 1056727.674 NY W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3401 -E -f '%.3f' >>${OUT} <<EOF + -80d49'28.238 40d17'50.894 2467363.986 234305.751 OH N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3401 -E -f '%.3f' >>${OUT} <<EOF + -82d37'31.021 40d20'14.678 1965071.932 244391.910 OH N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3402 -E -f '%.3f' >>${OUT} <<EOF + -84d15'00.000 39d45'00.000 1507970.925 642141.152 OH S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3501 -E -f '%.3f' >>${OUT} <<EOF + -98d42'45.414 36d50'19.568 1791448.615 670119.442 OK N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3501 -E -f '%.3f' >>${OUT} <<EOF + -95d38'44.046 35d20'36.925 2702176.218 133585.952 OK N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3502 -E -f '%.3f' >>${OUT} <<EOF + -97d08'00.000 34d34'00.000 2260914.787 449942.599 OK S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3601 -E -f '%.3f' >>${OUT} <<EOF + -123d41'00.000 45d31'00.000 1184216.898 690530.257 OR N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3602 -E -f '%.3f' >>${OUT} <<EOF + -119d46'26.562 44d24'25.943 2189746.353 999672.239 OR S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3602 -E -f '%.3f' >>${OUT} <<EOF + -121d09'56.105 44d23'08.924 1825970.576 991740.899 OR S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3701 -E -f '%.3f' >>${OUT} <<EOF + -74d33'20.644 41d23'48.566 2876202.339 464358.775 PA N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3701 -E -f '%.3f' >>${OUT} <<EOF + -78d09'48.121 40d51'35.455 1885652.438 252829.477 PA N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -67d08'56.930 18d29'56.972 251990.753 242253.319 PR F GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -66d52'30.000 18d15'00.000 346756.548 151479.295 PR F GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d15'00.000 500000.000 151294.491 PR F GP3 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d30'00.000 500000.000 242074.012 PR F GP4 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -67d08'56.930 18d29'56.972 251990.753 242253.319 PR M GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -66d52'30.000 18d15'00.000 346756.548 151479.295 PR M GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d15'00.000 500000.000 151294.491 PR M GP3 +EOF +../src/proj +units=us-ft +init=./nad27:5201 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d30'00.000 500000.000 242074.012 PR M GP4 +EOF +../src/proj +units=us-ft +init=./nad27:5202 -E -f '%.3f' >>${OUT} <<EOF + -64d43'00.000 17d40'00.000 1097602.972 42283.509 PS S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3800 -E -f '%.3f' >>${OUT} <<EOF + -71d16'00.833 41d32'24.848 563817.074 166563.592 RI GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3800 -E -f '%.3f' >>${OUT} <<EOF + -71d37'13.730 41d23'53.266 466943.554 114721.079 RI GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3901 -E -f '%.3f' >>${OUT} <<EOF + -80d32'30.000 34d32'30.000 2138028.224 561330.721 SC N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3901 -E -f '%.3f' >>${OUT} <<EOF + -81d00'00.000 34d32'30.000 2000000.000 561019.077 SC N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:3902 -E -f '%.3f' >>${OUT} <<EOF + -80d32'30.000 33d32'30.000 2139661.529 621836.603 SC S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:3902 -E -f '%.3f' >>${OUT} <<EOF + -81d00'00.000 33d32'30.000 2000000.000 621532.356 SC S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4001 -E -f '%.3f' >>${OUT} <<EOF + -99d12'21.983 44d06'08.121 2208566.880 99065.808 SD N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4001 -E -f '%.3f' >>${OUT} <<EOF + -100d32'28.873 44d32'34.917 1858852.206 259207.243 SD N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4002 -E -f '%.3f' >>${OUT} <<EOF + -103d14'00.000 44d06'00.000 1238344.555 657205.595 SD S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4100 -E -f '%.3f' >>${OUT} <<EOF + -85d13'55.967 36d21'48.503 2226074.895 718522.870 TN GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4100 -E -f '%.3f' >>${OUT} <<EOF + -88d43'05.849 36d30'08.410 1201097.659 779285.593 TN GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4203 -E -f '%.3f' >>${OUT} <<EOF + -97d06'00.000 31d35'00.000 3006704.541 711708.204 TX C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4201 -E -f '%.3f' >>${OUT} <<EOF + -100d33'06.303 34d39'35.684 2285173.373 241550.390 TX N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4201 -E -f '%.3f' >>${OUT} <<EOF + -102d48'50.949 34d43'39.249 1605118.921 267430.718 TX N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4205 -E -f '%.3f' >>${OUT} <<EOF + -97d30'00.000 25d55'00.000 2328727.194 92175.721 TX S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4202 -E -f '%.3f' >>${OUT} <<EOF + -96d48'00.000 32d45'00.000 2215204.973 394833.169 TXNC GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4204 -E -f '%.3f' >>${OUT} <<EOF + -98d30'00.000 29d25'00.000 2159176.237 576022.948 TXSC GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4302 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 38d40'00.000 2000000.000 121415.345 UT C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4302 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 38d40'30.000 2000000.000 124450.619 UT C GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4301 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 41d30'00.000 2000000.000 425057.445 UT N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4301 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 41d30'30.000 2000000.000 428093.810 UT N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4303 -E -f '%.3f' >>${OUT} <<EOF + -109d48'37.967 38d29'30.877 2483568.472 668988.098 UT S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4303 -E -f '%.3f' >>${OUT} <<EOF + -113d52'56.922 37d09'18.788 1305706.243 186731.606 UT S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d13'46.945 38d55'12.407 2361415.621 458962.786 VA N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4501 -E -f '%.3f' >>${OUT} <<EOF + -79d18'51.557 38d09'59.020 1765875.433 183017.881 VA N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d38'10.823 37d49'23.964 2249484.834 58221.695 VA N GP3 +EOF +../src/proj +units=us-ft +init=./nad27:4501 -E -f '%.3f' >>${OUT} <<EOF + -79d26'19.475 37d47'25.852 1728704.621 46487.604 VA N GP4 +EOF +../src/proj +units=us-ft +init=./nad27:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d44'30.336 39d00'06.804 2215488.016 487135.448 VA N GP6 +EOF +../src/proj +units=us-ft +init=./nad27:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d43'47.013 38d59'55.454 2218917.620 486015.701 VA N GP9 +EOF +../src/proj +units=us-ft +init=./nad27:4502 -E -f '%.3f' >>${OUT} <<EOF + -78d30'00.000 37d30'00.000 2000000.000 424763.516 VA S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4502 -E -f '%.3f' >>${OUT} <<EOF + -78d30'00.000 37d30'30.000 2000000.000 427797.710 VA S GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4502 -E -f '%.3f' >>${OUT} <<EOF + -77d32'33.000 36d54'42.507 2279939.213 212030.192 VA S GP3 +EOF +../src/proj +units=us-ft +init=./nad27:4502 -E -f '%.3f' >>${OUT} <<EOF + -77d21'55.732 38d04'53.901 2326572.191 638519.064 VA S GP4 +EOF +../src/proj +units=us-ft +init=./nad27:5202 -E -f '%.3f' >>${OUT} <<EOF + -64d45'30.000 17d45'30.000 1082794.001 75432.552 VI F GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5202 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 17d45'56.426 500000.000 75432.505 VI F GP2 +EOF +../src/proj +units=us-ft +init=./nad27:5202 -E -f '%.3f' >>${OUT} <<EOF + -64d45'30.000 17d45'30.000 1082794.001 75432.552 VI M GP1 +EOF +../src/proj +units=us-ft +init=./nad27:5202 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 17d45'56.426 500000.000 75432.505 VI M GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4400 -E -f '%.3f' >>${OUT} <<EOF + -72d29'31.418 43d09'58.526 502118.227 242816.621 VT GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4400 -E -f '%.3f' >>${OUT} <<EOF + -73d12'06.978 44d22'22.810 316451.963 683472.660 VT GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4601 -E -f '%.3f' >>${OUT} <<EOF + -119d51'37.006 47d50'51.069 2238927.196 310658.148 WA N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4601 -E -f '%.3f' >>${OUT} <<EOF + -123d59'49.087 48d09'29.131 1228043.506 438306.777 WA N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4602 -E -f '%.3f' >>${OUT} <<EOF + -122d54'00.000 46d09'00.000 1391814.257 307059.945 WA S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4802 -E -f '%.3f' >>${OUT} <<EOF + -88d04'00.000 44d30'00.000 2504399.560 249042.105 WI C GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4801 -E -f '%.3f' >>${OUT} <<EOF + -88d44'40.778 45d22'21.598 2322632.765 77666.151 WI N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4801 -E -f '%.3f' >>${OUT} <<EOF + -92d12'19.275 45d48'35.812 1437681.450 242373.846 WI N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4803 -E -f '%.3f' >>${OUT} <<EOF + -89d23'00.000 43d05'00.000 2164743.544 395445.420 WI S GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4701 -E -f '%.3f' >>${OUT} <<EOF + -77d53'39.269 39d14'39.339 2454764.840 275139.246 WV N GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4701 -E -f '%.3f' >>${OUT} <<EOF + -81d33'23.549 39d18'08.535 1418073.862 298900.611 WV N GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4701 -E -f '%.3f' >>${OUT} <<EOF + -77d30'10.460 38d59'25.903 2567632.286 184970.946 WV N GP3 +EOF +../src/proj +units=us-ft +init=./nad27:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d07'00.000 44d38'00.000 513016.009 1445570.355 WY E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d31'02.882 43d30'40.600 406937.677 1036750.418 WY E GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d22'42.856 43d30'14.685 443778.141 1034002.062 WY E GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d28'42.827 43d36'33.391 417392.389 1072428.186 WY E GP3 +EOF +../src/proj +units=us-ft +init=./nad27:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d23'43.223 42d00'59.422 437860.186 491889.060 WY E GP4 +EOF +../src/proj +units=us-ft +init=./nad27:4901 -E -f '%.3f' >>${OUT} <<EOF + -104d35'06.686 42d34'50.366 656606.905 697923.643 WY E GP5 +EOF +../src/proj +units=us-ft +init=./nad27:4904 -E -f '%.3f' >>${OUT} <<EOF + -110d36'00.000 41d48'00.000 359125.204 413338.815 WY W GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4902 -E -f '%.3f' >>${OUT} <<EOF + -106d13'03.224 41d36'14.640 805153.891 343496.746 WYEC GP1 +EOF +../src/proj +units=us-ft +init=./nad27:4902 -E -f '%.3f' >>${OUT} <<EOF + -108d01'56.720 41d51'57.518 309581.204 437731.262 WYEC GP2 +EOF +../src/proj +units=us-ft +init=./nad27:4903 -E -f '%.3f' >>${OUT} <<EOF + -108d24'00.000 43d02'00.000 593579.361 862553.590 WYWC GP1 +EOF +# +# do 'diff' with distribution results +echo "diff ${OUT} with pj_out27.dist" +diff ${OUT} pj_out27.dist +if [ $? -ne 0 ] ; then + echo "" + echo "PROBLEMS HAVE OCCURED" + echo "test file ${OUT} saved" +else + echo "TEST OK" + echo "test file ${OUT} removed" + /bin/rm -f ${OUT} +fi diff --git a/nad/test83 b/nad/test83 new file mode 100755 index 00000000..7eb2fa34 --- /dev/null +++ b/nad/test83 @@ -0,0 +1,701 @@ +: +# Script to test most of the SPCS zones. +# +# This script generated from execution of NMD's program l176, where +# the second pair of numbers are respective easting and northing output. +# +# Proj will vary in the .001ft range with projections using Transverse +# Mercator due to greater precision of meridinal distance function. +# +OUT=proj_out83 +# +echo "doing tests into file ${OUT}, please wait" +# +../src/proj +units=us-ft +init=./nad83:5001 -E -f '%.3f' >${OUT} <<EOF + -134d00'00.000 55d00'00.000 2616018.154 1156379.643 AK 1 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5001 -E -f '%.3f' >>${OUT} <<EOF + -133d40'00.000 57d00'00.000 2685941.919 1886799.668 AK 1 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5001 -E -f '%.3f' >>${OUT} <<EOF + -131d35'45.432 54d39'02.654 3124531.426 1035343.511 AK 1 GP3 +EOF +../src/proj +units=us-ft +init=./nad83:5001 -E -f '%.3f' >>${OUT} <<EOF + -129d32'30.000 54d32'30.000 3561448.345 1015025.876 AK 1 GP4 +EOF +../src/proj +units=us-ft +init=./nad83:5001 -E -f '%.3f' >>${OUT} <<EOF + -141d30'00.000 60d30'00.000 1276328.587 3248159.207 AK 1 GP6 +EOF +../src/proj +units=us-ft +init=./nad83:5002 -E -f '%.3f' >>${OUT} <<EOF + -142d00'00.000 56d30'30.000 1640416.667 916074.825 AK 2 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5003 -E -f '%.3f' >>${OUT} <<EOF + -146d00'00.000 56d30'30.000 1640416.667 916074.825 AK 3 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5004 -E -f '%.3f' >>${OUT} <<EOF + -150d00'00.000 56d30'30.000 1640416.667 916074.825 AK 4 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5005 -E -f '%.3f' >>${OUT} <<EOF + -152d28'56.134 60d53'28.765 1910718.662 2520810.680 AK 5 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5005 -E -f '%.3f' >>${OUT} <<EOF + -154d00'00.000 56d30'30.000 1640416.667 916074.825 AK 5 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5006 -E -f '%.3f' >>${OUT} <<EOF + -155d00'00.000 71d00'00.000 1998036.998 6224208.217 AK 6 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5006 -E -f '%.3f' >>${OUT} <<EOF + -158d00'00.000 71d00'00.000 1640416.667 6215353.367 AK 6 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5007 -E -f '%.3f' >>${OUT} <<EOF + -162d00'00.000 65d15'00.000 1640416.667 4111446.441 AK 7 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5008 -E -f '%.3f' >>${OUT} <<EOF + -166d00'00.000 65d15'00.000 1640416.667 4111446.441 AK 8 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5009 -E -f '%.3f' >>${OUT} <<EOF + -170d00'00.000 63d20'00.000 1640416.667 3410489.717 AK 9 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5010 -E -f '%.3f' >>${OUT} <<EOF + -164d02'30.000 54d27'30.000 5814167.604 1473788.834 AK10 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5010 -E -f '%.3f' >>${OUT} <<EOF + -176d00'00.000 52d30'00.000 3280833.333 547580.542 AK10 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:101 -E -f '%.3f' >>${OUT} <<EOF + -85d50'00.000 31d20'00.000 656166.667 303104.183 AL E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:101 -E -f '%.3f' >>${OUT} <<EOF + -85d12'41.738 32d38'57.737 847539.085 782420.807 AL E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:101 -E -f '%.3f' >>${OUT} <<EOF + -86d36'58.670 34d48'58.708 421151.975 1571298.908 AL E GP3 +EOF +../src/proj +units=us-ft +init=./nad83:102 -E -f '%.3f' >>${OUT} <<EOF + -87d30'00.000 33d20'00.000 1968500.000 1212527.587 AL W GP1 +EOF +../src/proj +units=us-ft +init=./nad83:102 -E -f '%.3f' >>${OUT} <<EOF + -87d30'00.000 33d20'30.000 1968500.000 1215559.708 AL W GP2 +EOF +../src/proj +units=us-ft +init=./nad83:301 -E -f '%.3f' >>${OUT} <<EOF + -91d34'46.321 35d18'37.443 1437779.156 355900.759 AR N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:301 -E -f '%.3f' >>${OUT} <<EOF + -92d04'11.625 35d19'34.269 1291483.982 361385.695 AR N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:302 -E -f '%.3f' >>${OUT} <<EOF + -92d00'00.000 34d45'00.000 1312333.333 2070451.744 AR S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:302 -E -f '%.3f' >>${OUT} <<EOF + -92d00'00.000 33d15'00.000 1312333.333 1524603.730 AR S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:202 -E -f '%.3f' >>${OUT} <<EOF + -111d55'00.000 34d45'00.000 699998.600 1364309.666 AZ C GP1 +EOF +../src/proj +units=us-ft +init=./nad83:202 -E -f '%.3f' >>${OUT} <<EOF + -111d55'00.000 32d20'00.000 699998.600 484994.340 AZ C GP2 +EOF +../src/proj +units=us-ft +init=./nad83:201 -E -f '%.3f' >>${OUT} <<EOF + -110d24'59.771 35d09'58.568 625301.460 1515899.830 AZ E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:201 -E -f '%.3f' >>${OUT} <<EOF + -109d34'33.127 31d59'53.103 883142.524 363539.663 AZ E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:201 -E -f '%.3f' >>${OUT} <<EOF + -110d30'34.948 35d07'28.243 597423.277 1500785.235 AZ E GP3 +EOF +../src/proj +units=us-ft +init=./nad83:201 -E -f '%.3f' >>${OUT} <<EOF + -109d45'13.226 32d08'41.778 827818.955 416705.394 AZ E GP4 +EOF +../src/proj +units=us-ft +init=./nad83:203 -E -f '%.3f' >>${OUT} <<EOF + -113d45'00.000 34d45'00.000 699998.600 1364355.147 AZ W GP1 +EOF +../src/proj +units=us-ft +init=./nad83:203 -E -f '%.3f' >>${OUT} <<EOF + -113d45'00.000 34d45'30.000 699998.600 1367387.968 AZ W GP2 +EOF +../src/proj +units=us-ft +init=./nad83:203 -E -f '%.3f' >>${OUT} <<EOF + -113d45'00.000 34d46'00.000 699998.600 1370420.793 AZ W GP3 +EOF +../src/proj +units=us-ft +init=./nad83:401 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 41d30'00.000 6561666.667 2429744.729 CA 1 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:401 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 41d30'30.000 6561666.667 2432781.128 CA 1 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:402 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 39d20'00.000 6561666.667 2247404.250 CA 2 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:402 -E -f '%.3f' >>${OUT} <<EOF + -122d00'00.000 39d20'30.000 6561666.667 2250439.391 CA 2 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:403 -E -f '%.3f' >>${OUT} <<EOF + -120d30'00.000 37d05'00.000 6561666.667 1852815.760 CA 3 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:403 -E -f '%.3f' >>${OUT} <<EOF + -121d22'26.019 37d30'30.324 6308189.835 2008776.145 CA 3 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:403 -E -f '%.3f' >>${OUT} <<EOF + -119d46'32.733 37d07'41.470 6772808.251 1869963.783 CA 3 GP3 +EOF +../src/proj +units=us-ft +init=./nad83:403 -E -f '%.3f' >>${OUT} <<EOF + -119d38'26.434 36d55'48.009 6812851.254 1798140.563 CA 3 GP4 +EOF +../src/proj +units=us-ft +init=./nad83:403 -E -f '%.3f' >>${OUT} <<EOF + -120d42'59.779 38d06'52.815 6499349.432 2228414.867 CA 3 GP5 +EOF +../src/proj +units=us-ft +init=./nad83:404 -E -f '%.3f' >>${OUT} <<EOF + -119d00'00.000 36d20'00.000 6561666.667 2004462.102 CA 4 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:404 -E -f '%.3f' >>${OUT} <<EOF + -119d00'00.000 36d20'30.000 6561666.667 2007495.782 CA 4 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:405 -E -f '%.3f' >>${OUT} <<EOF + -118d00'00.000 34d45'00.000 6561666.667 2095323.781 CA 5 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:405 -E -f '%.3f' >>${OUT} <<EOF + -118d00'00.000 34d45'30.000 6561666.667 2098356.568 CA 5 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:406 -E -f '%.3f' >>${OUT} <<EOF + -116d15'00.000 33d20'00.000 6561666.667 2064911.626 CA 6 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:406 -E -f '%.3f' >>${OUT} <<EOF + -116d15'00.000 33d20'30.000 6561666.667 2067943.810 CA 6 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:406 -E -f '%.3f' >>${OUT} <<EOF + -118d20'00.000 34d30'00.000 5933874.572 2495758.727 CA 7 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:502 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 39d15'00.000 3000000.000 1515946.820 CO C GP1 +EOF +../src/proj +units=us-ft +init=./nad83:502 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 39d15'30.000 3000000.000 1518981.963 CO C GP2 +EOF +../src/proj +units=us-ft +init=./nad83:501 -E -f '%.3f' >>${OUT} <<EOF + -108d45'55.378 40d25'33.504 2091110.958 1414758.884 CO N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:501 -E -f '%.3f' >>${OUT} <<EOF + -105d14'45.588 40d12'42.711 3070938.779 1320125.979 CO N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:503 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 37d30'00.000 3000000.000 1303432.168 CO S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:503 -E -f '%.3f' >>${OUT} <<EOF + -105d30'00.000 37d30'30.000 3000000.000 1306466.471 CO S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:600 -E -f '%.3f' >>${OUT} <<EOF + -72d43'30.515 41d16'55.847 1006831.954 663542.786 CT GP1 +EOF +../src/proj +units=us-ft +init=./nad83:600 -E -f '%.3f' >>${OUT} <<EOF + -73d01'15.609 41d13'25.985 925448.220 642418.129 CT GP2 +EOF +../src/proj +units=us-ft +init=./nad83:700 -E -f '%.3f' >>${OUT} <<EOF + -75d33'00.748 39d21'15.214 618403.524 493238.843 DE GP1 +EOF +../src/proj +units=us-ft +init=./nad83:700 -E -f '%.3f' >>${OUT} <<EOF + -75d19'01.889 39d45'14.765 684135.532 638883.528 DE GP2 +EOF +../src/proj +units=us-ft +init=./nad83:903 -E -f '%.3f' >>${OUT} <<EOF + -82d45'52.412 29d39'06.589 2519743.236 241248.726 FL N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:903 -E -f '%.3f' >>${OUT} <<EOF + -84d55'11.533 29d38'51.982 1835122.674 235823.399 FL N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1001 -E -f '%.3f' >>${OUT} <<EOF + -81d27'15.592 32d38'03.003 875449.222 958850.568 GA E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1001 -E -f '%.3f' >>${OUT} <<EOF + -83d15'39.990 33d29'58.626 322535.391 1274748.301 GA E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d59'16.911 19d37'23.477 1472470.137 287083.198 HI 1 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d18'06.262 19d31'24.578 1708685.701 250676.240 HI 1 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d30'00.000 19d42'00.000 1640416.667 314739.275 HI 1 GP3 +EOF +../src/proj +units=us-ft +init=./nad83:5101 -E -f '%.3f' >>${OUT} <<EOF + -155d30'00.000 19d42'30.000 1640416.667 317765.760 HI 1 GP4 +EOF +../src/proj +units=us-ft +init=./nad83:5102 -E -f '%.3f' >>${OUT} <<EOF + -156d40'00.000 20d42'00.000 1640416.667 133177.588 HI 2 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5102 -E -f '%.3f' >>${OUT} <<EOF + -156d40'00.000 20d42'30.000 1640416.667 136204.417 HI 2 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5103 -E -f '%.3f' >>${OUT} <<EOF + -158d00'00.000 21d30'00.000 1640416.667 121084.931 HI 3 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5103 -E -f '%.3f' >>${OUT} <<EOF + -158d01'30.000 21d37'30.000 1631925.017 166493.704 HI 3 GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5104 -E -f '%.3f' >>${OUT} <<EOF + -159d30'00.000 22d05'00.000 1640416.667 90820.525 HI 4 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5105 -E -f '%.3f' >>${OUT} <<EOF + -160d10'00.000 21d42'00.000 1640416.667 12109.121 HI 5 GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1401 -E -f '%.3f' >>${OUT} <<EOF + -93d28'33.966 42d44'50.101 4927669.136 3735362.601 IA N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1401 -E -f '%.3f' >>${OUT} <<EOF + -93d54'22.084 42d40'23.699 4812032.409 3708655.393 IA N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1101 -E -f '%.3f' >>${OUT} <<EOF + -111d42'29.824 43d48'07.616 777180.670 778579.414 ID E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1101 -E -f '%.3f' >>${OUT} <<EOF + -112d22'35.516 43d35'26.260 600566.613 701226.817 ID E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1103 -E -f '%.3f' >>${OUT} <<EOF + -116d22'02.592 48d07'50.941 2473902.726 2357266.577 ID W GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1201 -E -f '%.3f' >>${OUT} <<EOF + -88d07'06.790 41d46'11.855 1042839.901 1858837.259 IL E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1201 -E -f '%.3f' >>${OUT} <<EOF + -88d41'35.208 40d43'37.202 884532.422 1478959.912 IL E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1301 -E -f '%.3f' >>${OUT} <<EOF + -85d40'00.000 40d00'00.000 328083.333 1730697.447 IN E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1301 -E -f '%.3f' >>${OUT} <<EOF + -85d40'00.000 40d00'30.000 328083.333 1733733.066 IN E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1301 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.780 40d00'12.690 167175.533 1732499.995 IN E GP3 +EOF +../src/proj +units=us-ft +init=./nad83:1301 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.790 40d00'31.660 167187.126 1734419.540 IN E GP4 +EOF +../src/proj +units=us-ft +init=./nad83:1301 -E -f '%.3f' >>${OUT} <<EOF + -86d14'28.103 40d00'47.412 167173.047 1736013.616 IN E GP6 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d05'00.000 40d00'00.000 2952750.000 1730697.447 IN W GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d05'00.000 40d00'30.000 2952750.000 1733733.066 IN W GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d45'10.717 39d41'24.840 3045717.498 1618031.699 IN W GP3 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d41'44.075 37d54'24.755 2776105.988 968944.255 IN W GP4 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d32'13.179 39d32'46.419 3106817.690 1565874.113 IN W GP5 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -87d25'26.675 38d26'17.646 2855150.544 1162044.125 IN W GP6 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d14'28.103 40d00'47.412 3188649.790 1736609.724 IN W GP7 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.780 40d00'12.690 3188708.130 1733096.467 IN W GP8 +EOF +../src/proj +units=us-ft +init=./nad83:1302 -E -f '%.3f' >>${OUT} <<EOF + -86d14'27.790 40d00'31.660 3188689.210 1735016.020 IN W GP9 +EOF +../src/proj +units=us-ft +init=./nad83:1501 -E -f '%.3f' >>${OUT} <<EOF + -96d47'54.567 38d58'52.096 1653880.047 238201.110 KS N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1501 -E -f '%.3f' >>${OUT} <<EOF + -98d35'23.954 39d58'41.967 1146983.460 599694.197 KS N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1601 -E -f '%.3f' >>${OUT} <<EOF + -84d05'43.283 38d14'35.963 1684830.325 270726.733 KY N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1601 -E -f '%.3f' >>${OUT} <<EOF + -84d26'49.265 39d04'03.099 1584475.157 570918.805 KY N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1701 -E -f '%.3f' >>${OUT} <<EOF + -91d34'46.483 31d57'26.243 3566283.410 531318.874 LA N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1701 -E -f '%.3f' >>${OUT} <<EOF + -92d52'46.615 32d54'52.264 3164322.062 878564.036 LA N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1701 -E -f '%.3f' >>${OUT} <<EOF + -91d29'09.480 31d56'44.721 3595353.711 527382.519 LA N GP3 +EOF +../src/proj +units=us-ft +init=./nad83:1701 -E -f '%.3f' >>${OUT} <<EOF + -93d59'38.241 32d48'43.467 2821809.119 844247.864 LA N GP4 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d00'00.000 28d50'00.000 4027995.272 128836.330 LA S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d30'00.000 28d50'00.000 3867904.667 125925.406 LA S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d29'59.999 29d19'59.994 3864995.756 307730.820 LA S GP3 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d00'00.004 29d19'59.998 4024292.645 310627.715 LA S GP4 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d10'23.487 29d20'32.615 3969054.663 312839.922 LA S GP5 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d06'34.632 29d15'19.642 3989919.298 281618.678 LA S GP6 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d01'33.803 29d07'47.918 4017480.813 236523.957 LA S GP7 +EOF +../src/proj +units=us-ft +init=./nad83:1702 -E -f '%.3f' >>${OUT} <<EOF + -89d08'45.781 28d58'27.979 3980254.597 179219.900 LA S GP9 +EOF +../src/proj +units=us-ft +init=./nad83:2001 -E -f '%.3f' >>${OUT} <<EOF + -70d27'00.716 41d40'15.808 942982.782 2706924.168 MA M GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2001 -E -f '%.3f' >>${OUT} <<EOF + -73d25'59.173 42d06'06.860 131613.265 2868104.007 MA M GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1900 -E -f '%.3f' >>${OUT} <<EOF + -76d11'27.492 39d12'06.132 1541600.105 560062.872 MD GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1900 -E -f '%.3f' >>${OUT} <<EOF + -77d02'30.406 38d26'37.492 1300367.185 283004.738 MD GP2 +EOF +../src/proj +units=us-ft +init=./nad83:1900 -E -f '%.3f' >>${OUT} <<EOF + -77d30'10.460 38d59'25.903 1169392.711 482527.897 MD GP3 +EOF +../src/proj +units=us-ft +init=./nad83:1801 -E -f '%.3f' >>${OUT} <<EOF + -68d24'25.489 46d32'46.920 1007629.154 1049880.999 ME E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:1801 -E -f '%.3f' >>${OUT} <<EOF + -68d37'29.366 47d02'12.659 953127.598 1228762.971 ME E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2113 -E -f '%.3f' >>${OUT} <<EOF + -83d29'17.919 42d19'19.299 13360865.013 300809.378 MI S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2113 -E -f '%.3f' >>${OUT} <<EOF + -83d35'24.656 42d20'02.682 13333276.507 304929.978 MI S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2113 -E -f '%.3f' >>${OUT} <<EOF + -85d55'26.569 41d50'10.236 12698916.149 126441.631 MI S GP3 +EOF +../src/proj +units=us-ft +init=./nad83:2113 -E -f '%.3f' >>${OUT} <<EOF + -85d45'59.490 41d49'22.346 12741759.240 120840.463 MI S GP4 +EOF +../src/proj +units=us-ft +init=./nad83:2201 -E -f '%.3f' >>${OUT} <<EOF + -91d27'51.183 47d08'19.177 3031741.394 565338.600 MN N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2201 -E -f '%.3f' >>${OUT} <<EOF + -95d51'05.998 48d19'26.552 1955378.869 1005314.701 MN N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2402 -E -f '%.3f' >>${OUT} <<EOF + -92d30'00.000 38d15'00.000 1640416.667 879854.176 MO C GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2402 -E -f '%.3f' >>${OUT} <<EOF + -92d30'00.000 38d15'30.000 1640416.667 882888.780 MO C GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2401 -E -f '%.3f' >>${OUT} <<EOF + -91d42'04.297 37d22'05.932 471136.507 561031.592 MO E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2401 -E -f '%.3f' >>${OUT} <<EOF + -90d08'08.896 36d53'44.124 926703.606 386902.829 MO E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2403 -E -f '%.3f' >>${OUT} <<EOF + -94d30'00.000 38d15'00.000 2788708.333 758522.219 MO W GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2403 -E -f '%.3f' >>${OUT} <<EOF + -94d30'00.000 38d15'30.000 2788708.333 761556.846 MO W GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2301 -E -f '%.3f' >>${OUT} <<EOF + -89d10'14.013 30d30'51.338 878059.046 369015.468 MS E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2301 -E -f '%.3f' >>${OUT} <<EOF + -88d26'04.338 30d43'01.454 1109567.483 442842.466 MS E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2500 -E -f '%.3f' >>${OUT} <<EOF + -106d29'11.521 47d52'21.103 2707564.623 1334850.273 MT N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2500 -E -f '%.3f' >>${OUT} <<EOF + -114d30'43.122 48d52'46.764 763315.457 1726511.247 MT N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3200 -E -f '%.3f' >>${OUT} <<EOF + -81d12'31.790 35d09'31.049 1339869.379 520003.003 NC GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3200 -E -f '%.3f' >>${OUT} <<EOF + -76d31'54.918 35d33'51.452 2733923.842 669426.932 NC GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3200 -E -f '%.3f' >>${OUT} <<EOF + -78d28'26.580 36d15'15.480 2155084.559 911885.081 NC GP3 +EOF +../src/proj +units=us-ft +init=./nad83:3301 -E -f '%.3f' >>${OUT} <<EOF + -98d46'03.232 48d08'13.483 2391470.474 419526.909 ND N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3301 -E -f '%.3f' >>${OUT} <<EOF + -101d18'21.456 47d39'18.935 1769873.906 240054.790 ND N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2600 -E -f '%.3f' >>${OUT} <<EOF + -96d17'52.930 42d04'48.305 2644820.409 839912.565 NE N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2600 -E -f '%.3f' >>${OUT} <<EOF + -100d49'26.949 41d58'54.025 1416403.828 783622.046 NE N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2800 -E -f '%.3f' >>${OUT} <<EOF + -70d56'11.287 43d08'15.006 1179151.981 233188.620 NH GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2800 -E -f '%.3f' >>${OUT} <<EOF + -72d32'32.197 42d51'25.984 749470.166 131406.173 NH GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2900 -E -f '%.3f' >>${OUT} <<EOF + -74d13'55.737 39d52'02.095 567304.543 376673.733 NJ GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2900 -E -f '%.3f' >>${OUT} <<EOF + -74d51'24.058 41d12'07.401 393979.614 863010.549 NJ GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3002 -E -f '%.3f' >>${OUT} <<EOF + -106d15'00.000 33d30'00.000 1640416.667 909448.493 NM C GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3002 -E -f '%.3f' >>${OUT} <<EOF + -106d15'00.000 33d30'30.000 1640416.667 912480.595 NM C GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3001 -E -f '%.3f' >>${OUT} <<EOF + -104d11'42.410 33d17'21.732 583573.491 832847.194 NM E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3001 -E -f '%.3f' >>${OUT} <<EOF + -104d47'37.948 33d22'32.349 400747.149 864523.566 NM E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3003 -E -f '%.3f' >>${OUT} <<EOF + -107d50'00.000 32d30'00.000 2723091.667 545634.896 NM W GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3003 -E -f '%.3f' >>${OUT} <<EOF + -107d50'00.000 32d30'30.000 2723091.667 548666.562 NM W GP2 +EOF +../src/proj +units=us-ft +init=./nad83:2701 -E -f '%.3f' >>${OUT} <<EOF + -114d49'09.337 35d43'09.299 882966.545 26600313.129 NV E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:2701 -E -f '%.3f' >>${OUT} <<EOF + -116d50'32.766 41d30'37.869 311338.993 28710910.565 NV E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3101 -E -f '%.3f' >>${OUT} <<EOF + -74d02'53.671 42d17'01.775 614362.369 1257287.611 NY E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3101 -E -f '%.3f' >>${OUT} <<EOF + -74d44'39.818 42d30'07.382 426225.275 1336579.561 NY E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3104 -E -f '%.3f' >>${OUT} <<EOF + -73d02'36.247 40d47'50.624 1249103.533 231235.845 NY L GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3104 -E -f '%.3f' >>${OUT} <<EOF + -74d06'58.125 40d36'07.281 951997.667 158630.811 NY L GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3104 -E -f '%.3f' >>${OUT} <<EOF + -74d00'00.000 40d45'00.000 984250.000 212521.887 NY L GP3 +EOF +../src/proj +units=us-ft +init=./nad83:3104 -E -f '%.3f' >>${OUT} <<EOF + -73d15'00.000 40d37'30.000 1192442.028 167871.999 NY L GP4 +EOF +../src/proj +units=us-ft +init=./nad83:3104 -E -f '%.3f' >>${OUT} <<EOF + -73d22'30.000 40d45'00.000 1157419.074 213139.664 NY L GP5 +EOF +../src/proj +units=us-ft +init=./nad83:3401 -E -f '%.3f' >>${OUT} <<EOF + -80d49'28.238 40d17'50.894 2435851.621 234309.717 OH N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3401 -E -f '%.3f' >>${OUT} <<EOF + -82d37'31.021 40d20'14.678 1933572.857 244396.244 OH N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3501 -E -f '%.3f' >>${OUT} <<EOF + -98d42'45.414 36d50'19.568 1759953.675 670136.468 OK N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3501 -E -f '%.3f' >>${OUT} <<EOF + -95d38'44.046 35d20'36.925 2670659.833 133589.112 OK N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3602 -E -f '%.3f' >>${OUT} <<EOF + -119d46'26.562 44d24'25.943 5110990.827 999684.042 OR S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3602 -E -f '%.3f' >>${OUT} <<EOF + -121d09'56.105 44d23'08.924 4747225.642 991752.635 OR S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3701 -E -f '%.3f' >>${OUT} <<EOF + -74d33'20.644 41d23'48.566 2844678.533 464365.610 PA N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3701 -E -f '%.3f' >>${OUT} <<EOF + -78d09'48.121 40d51'35.455 1854155.505 252833.700 PA N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -67d08'56.930 18d29'56.972 408161.046 898432.808 PR F GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d52'30.000 18d15'00.000 502925.440 807654.009 PR F GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d15'00.000 656166.667 807469.207 PR F GP3 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d30'00.000 656166.667 898253.524 PR F GP4 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -67d08'56.930 18d29'56.972 408161.046 898432.808 PR M GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d52'30.000 18d15'00.000 502925.440 807654.009 PR M GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d15'00.000 656166.667 807469.207 PR M GP3 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 18d30'00.000 656166.667 898253.524 PR M GP4 +EOF +../src/proj +units=us-ft +init=./nad83:3800 -E -f '%.3f' >>${OUT} <<EOF + -71d16'00.833 41d32'24.848 391898.667 166566.121 RI GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3800 -E -f '%.3f' >>${OUT} <<EOF + -71d37'13.730 41d23'53.266 295027.785 114722.837 RI GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3900 -E -f '%.3f' >>${OUT} <<EOF + -80d32'30.000 34d32'30.000 2138015.480 985710.127 SC N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3900 -E -f '%.3f' >>${OUT} <<EOF + -81d00'00.000 34d32'30.000 1999996.000 985404.077 SC N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:3900 -E -f '%.3f' >>${OUT} <<EOF + -80d32'30.000 33d32'30.000 2139629.138 621856.156 SC S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:3900 -E -f '%.3f' >>${OUT} <<EOF + -81d00'00.000 33d32'30.000 1999996.000 621546.527 SC S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4001 -E -f '%.3f' >>${OUT} <<EOF + -99d12'21.983 44d06'08.121 2177060.848 99066.761 SD N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4001 -E -f '%.3f' >>${OUT} <<EOF + -100d32'28.873 44d32'34.917 1827356.330 259209.712 SD N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4100 -E -f '%.3f' >>${OUT} <<EOF + -85d13'55.967 36d21'48.503 2194569.476 739881.374 TN GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4100 -E -f '%.3f' >>${OUT} <<EOF + -88d43'05.849 36d30'08.410 1169616.875 800645.091 TN GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4201 -E -f '%.3f' >>${OUT} <<EOF + -100d33'06.303 34d39'35.684 941333.504 3522390.511 TX N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4201 -E -f '%.3f' >>${OUT} <<EOF + -102d48'50.949 34d43'39.249 261294.654 3548271.494 TX N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4302 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 38d40'00.000 1640416.667 6683084.515 UT C GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4302 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 38d40'30.000 1640416.667 6686119.851 UT C GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4301 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 41d30'00.000 1640416.667 3705897.565 UT N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4301 -E -f '%.3f' >>${OUT} <<EOF + -111d30'00.000 41d30'30.000 1640416.667 3708933.975 UT N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4303 -E -f '%.3f' >>${OUT} <<EOF + -109d48'37.967 38d29'30.877 2123972.902 10511502.846 UT S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4303 -E -f '%.3f' >>${OUT} <<EOF + -113d52'56.922 37d09'18.788 946139.893 10029235.592 UT S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d13'46.945 38d55'12.407 11844323.043 7020638.975 VA N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4501 -E -f '%.3f' >>${OUT} <<EOF + -79d18'51.557 38d09'59.020 11248797.976 6744688.474 VA N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d38'10.823 37d49'23.964 11732395.294 6619889.590 VA N GP3 +EOF +../src/proj +units=us-ft +init=./nad83:4501 -E -f '%.3f' >>${OUT} <<EOF + -79d26'19.475 37d47'25.852 11211628.032 6608155.232 VA N GP4 +EOF +../src/proj +units=us-ft +init=./nad83:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d44'30.336 39d00'06.804 11698399.159 7048812.266 VA N GP6 +EOF +../src/proj +units=us-ft +init=./nad83:4501 -E -f '%.3f' >>${OUT} <<EOF + -77d43'47.013 38d59'55.454 11701828.676 7047692.496 VA N GP9 +EOF +../src/proj +units=us-ft +init=./nad83:4502 -E -f '%.3f' >>${OUT} <<EOF + -78d30'00.000 37d30'00.000 11482916.667 3705606.876 VA S GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4502 -E -f '%.3f' >>${OUT} <<EOF + -78d30'00.000 37d30'30.000 11482916.667 3708641.137 VA S GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4502 -E -f '%.3f' >>${OUT} <<EOF + -77d32'33.000 36d54'42.507 11762849.074 3492868.579 VA S GP3 +EOF +../src/proj +units=us-ft +init=./nad83:4502 -E -f '%.3f' >>${OUT} <<EOF + -77d21'55.732 38d04'53.901 11809480.679 3919367.025 VA S GP4 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -64d45'30.000 17d45'30.000 1238952.313 631597.723 VI F GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 17d45'56.426 656166.667 631597.858 VI F GP2 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -64d45'30.000 17d45'30.000 1238952.313 631597.723 VI M GP1 +EOF +../src/proj +units=us-ft +init=./nad83:5200 -E -f '%.3f' >>${OUT} <<EOF + -66d26'00.000 17d45'56.426 656166.667 631597.858 VI M GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4400 -E -f '%.3f' >>${OUT} <<EOF + -72d29'31.418 43d09'58.526 1642534.834 242819.594 VT GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4400 -E -f '%.3f' >>${OUT} <<EOF + -73d12'06.978 44d22'22.810 1456873.971 683480.189 VT GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4601 -E -f '%.3f' >>${OUT} <<EOF + -119d51'37.006 47d50'51.069 1879336.368 310659.110 WA N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4601 -E -f '%.3f' >>${OUT} <<EOF + -123d59'49.087 48d09'29.131 868484.545 438307.526 WA N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4801 -E -f '%.3f' >>${OUT} <<EOF + -88d44'40.778 45d22'21.598 2291123.165 77666.637 WI N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4801 -E -f '%.3f' >>${OUT} <<EOF + -92d12'19.275 45d48'35.812 1406198.343 242375.264 WI N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4701 -E -f '%.3f' >>${OUT} <<EOF + -77d53'39.269 39d14'39.339 2423253.113 275144.536 WV N GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4701 -E -f '%.3f' >>${OUT} <<EOF + -81d33'23.549 39d18'08.535 1386588.889 298906.239 WV N GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4701 -E -f '%.3f' >>${OUT} <<EOF + -77d30'10.460 38d59'25.903 2536117.742 184974.384 WV N GP3 +EOF +../src/proj +units=us-ft +init=./nad83:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d31'02.882 43d30'40.600 563107.342 1097477.489 WY E GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d22'42.856 43d30'14.685 599946.619 1094729.119 WY E GP2 +EOF +../src/proj +units=us-ft +init=./nad83:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d28'42.827 43d36'33.391 573561.723 1133155.514 WY E GP3 +EOF +../src/proj +units=us-ft +init=./nad83:4901 -E -f '%.3f' >>${OUT} <<EOF + -105d23'43.223 42d00'59.422 594028.794 552611.396 WY E GP4 +EOF +../src/proj +units=us-ft +init=./nad83:4901 -E -f '%.3f' >>${OUT} <<EOF + -104d35'06.686 42d34'50.366 812768.620 758647.940 WY E GP5 +EOF +../src/proj +units=us-ft +init=./nad83:4902 -E -f '%.3f' >>${OUT} <<EOF + -106d13'03.224 41d36'14.640 1617477.770 732300.770 WYEC GP1 +EOF +../src/proj +units=us-ft +init=./nad83:4902 -E -f '%.3f' >>${OUT} <<EOF + -108d01'56.720 41d51'57.518 1121920.469 826536.345 WYEC GP2 +EOF +# +# do 'diff' with distribution results +echo "diff ${OUT} with pj_out83.dist" +diff ${OUT} pj_out83.dist +if [ $? -ne 0 ] ; then + echo "" + echo "PROBLEMS HAVE OCCURED" + echo "test file ${OUT} saved" +else + echo "TEST OK" + echo "test file ${OUT} removed" + /bin/rm -f ${OUT} +fi diff --git a/nad/world b/nad/world new file mode 100644 index 00000000..42b21de5 --- /dev/null +++ b/nad/world @@ -0,0 +1,176 @@ +# SCCSID @(#)world 1.2 95/08/05 GIE REL +# proj +init files for various non-U.S. coordinate systems. +# +<CH1903> # Swiss Coordinate System + +proj=somerc +lat_0=46d57'8.660"N +lon_0=7d26'22.500"E + +ellps=bessel +x_0=600000 +y_0=200000 + +k_0=1. no_defs <> +<madagascar> # Laborde grid for Madagascar + proj=labrd ellps=intl lon_0=46d26'13.95E lat_0=18d54S + azi=18d54 k_0=.9995 x_0=400000 y_0=800000 + no_defs <> +<new_zealand> # New Zealand Map Grid (NZMG) + proj=nzmg # Projection unique to N.Z. so all factors fixed + no_defs <> +# Secondary grids DMA TM8358.1, p. 4.3 +<bwi> # British West Indies + proj=tmerc ellps=clrk80 lon_0=62W + x_0=400000 k_0=0.9995 + no_defs <> +<costa-n> # Costa Rica Norte + proj=lcc ellps=clrk66 lat_1=10d28N lon_0=84d20W + x_0=500000 y_0=217820.522 k_0=0.99995696 + no_defs <> +<costa-s> # Costa Rica Sud + proj=lcc ellps=clrk66 lat_1=9dN lon_0=83d40W + x_0=500000 y_0=327987.436 k_0=0.99995696 + no_defs <> +<cuba-n> # Cuba Norte + proj=lcc ellps=clrk66 lat_1=22d21N lon_0=81dW + x_0=500000 y_0=280296.016 k_0=0.99993602 + no_defs <> +<cuba-s> # Cuba Sud + proj=lcc ellps=clrk66 lat_1=20d43'N lon_0=76d50'W + x_0=500000 y_0=229126.939 k_0=0.99994848 + no_defs <> +<domin_rep> # Dominican Republic + proj=lcc ellps=clrk66 lat_1=18d49'N lon_0=71d30'W + x_0=500000 y_0=277063.657 k_0=0.99991102 + no_defs <> +<egypt-1> # Egypt + proj=tmerc ellps=intl lon_0=25d30'E x_0=300000 k_0=0.99985 + no_defs <> +<egypt-2> # Egypt + proj=tmerc ellps=intl lon_0=28d30'E x_0=300000 k_0=0.99985 + no_defs <> +<egypt-3> # Egypt + proj=tmerc ellps=intl lon_0=31d30'E x_0=300000 k_0=0.99985 + no_defs <> +<egypt-4> # Egypt + proj=tmerc ellps=intl lon_0=34d30'E x_0=300000 k_0=0.99985 + no_defs <> +<egypt-5> # Egypt + proj=tmerc ellps=intl lon_0=37d30'E x_0=300000 k_0=0.99985 + no_defs <> +<el_sal> # El Salvador + proj=lcc ellps=clrk66 lat_1=13d47'N lon_0=89dW + x_0=500000 y_0=295809.184 k_0=0.99996704 + no_defs <> +<guat-n> # Guatemala Norte + proj=lcc ellps=clrk66 lat_1=16d49'N lon_0=90d20'W + x_0=500000 y_0=292209.579 k_0=0.99992226 + no_defs <> +<guat-s> # Guatemala Sud + proj=lcc ellps=clrk66 lat_1=14d54'N lon_0=90d20'W + x_0=500000 y_0=325992.681 k_0=0.99989906 + no_defs <> +<haiti> # Haiti + proj=lcc ellps=clrk66 lat_1=18d49'N lon_0=71d30'W + x_0=500000 y_0=277063.657 k_0=0.99991102 + no_defs <> +<hond-n> # Honduras Norte + proj=lcc ellps=clrk66 lat_1=15d30'N lon_0=86d10'W + x_0=500000 y_0=296917.439 k_0=0.99993273 + no_defs <> +<hond-s> # Honduras Sud + proj=lcc ellps=clrk66 lat_1=13d47'N lon_0=87d10'W + x_0=500000 y_0=296215.903 k_0=0.99995140 + no_defs <> +<levant> # Levant + proj=lcc ellps=clrk66 lat_1=34d39'N lon_0=37d21'E + x_0=500000 y_0=300000 k_0=0.9996256 + no_defs <> +<nica-n> # Nicaragua Norte + proj=lcc ellps=clrk66 lat_1=13d52'N lon_0=85d30'W + x_0=500000 y_0=359891.816 k_0=0.99990314 + no_defs <> +<nica-s> # Nicaragua Sud + proj=lcc ellps=clrk66 lat_1=11d40'N lon_0=85d30'W + x_0=500000 y_0=288876.327 k_0=0.99992228 + no_defs <> +<nw-africa> # Northwest Africa + proj=lcc ellps=clrk80 lat_1=34dN lon_0=0dE + x_0=1000000 y_0=500000 k_0=0.99908 + no_defs <> +<palestine> # Palestine + proj=tmerc a=6378300.79 rf=293.488307656 + lat_0=31d44'2.749"N lon_0=35d12'43.490"E + x_0=170251.555 y_0=126867.909 k_0=1 + no_defs <> +<panama> # Panama + proj=lcc ellps=clrk66 lat_1=8d25'N lon_0=80dW + x_0=500000 y_0=294865.303 k_0=0.99989909 + no_defs <> +# other grids in DMA TM8358.1 +<bng> # British National Grid + proj=tmerc ellps=airy lat_0=49dN lon_0=2dW + k_0=0.9996012717 x_0=400000 y_0=-100000 + no_defs <> +<malay> # West Malaysian RSO Grid + proj=omerc a=6377295.66402 rf=300.8017 alpha=323d01'32.846" + no_uoff rot_conv lonc=102d15E lat_0=4dN k_0=0.99984 x_0=804670.240 y_0=0 + no_defs <> +<india-I> # India Zone I + proj=lcc ellps=everest lon_0=68E lat_1=32d30'N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<india-IIA> # India Zone IIA + proj=lcc ellps=everest lon_0=74E lat_1=26N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<india-IIB> # India Zone IIB + proj=lcc ellps=everest lon_0=90E lat_1=26N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<india-IIIA> # India Zone IIIA + proj=lcc ellps=everest lon_0=80E lat_1=19N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<india-IIIB> # India Zone IIIB + proj=lcc ellps=everest lon_0=100E lat_1=19N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<india-IVA> # India Zone IVA + proj=lcc ellps=everest lon_0=80E lat_1=12N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<india-IVB> # India Zone IVB + proj=lcc ellps=everest lon_0=104E lat_1=12N + x_0=2743185.69 y_0=914395.23 k_0=.998786408 + no_defs <> +<ceylon> # Ceylon Belt + proj=tmerc ellps=everest lon_0=80d46'18.160"E lat_0=7d0'1.729"N + x_0=160933.56048 y_0=160933.56048 k_0=1. + no_defs <> +<irish> # Irish Transverse Mercator Grid + proj=tmerx ellps=mod_airy lat_0=53d30'N lon_0=8W + x_0=200000 y_0=-250000 k_0=1.000035 + no_defs <> +<neiez> # Netherlands East Indies Equitorial Zone + proj=merc ellps=bessel lon_0=110E + x_0=3900000 y_0=900000 k_0=0.997 + no_defs <> +<n-alger> # Nord Algerie Grid + proj=lcc ellps=clrk80 lon_0=2d42E lat_0=36N + x_0=500000 y_0=300000 k_0=0.999625544 + no_defs <> +<n-maroc> # Nord Maroc Grid + proj=lcc ellps=clrk80 lon_0=5d24'W lat_0=33d18'N + x_0=500000 y_0=300000 k_0=0.999625769 + no_defs <> +<n-tunis> # Nord Tunisie Grid + proj=lcc ellps=clrk80 lon_0=9d54E lat_0=36N + x_0=500000 y_0=300000 k_0=0.999625544 + no_defs <> +<s-alger> # Sud Algerie Grid + proj=lcc ellps=clrk80 lon_0=2d42E lat_0=33d18'N + x_0=500000 y_0=300000 k_0=0.999625769 + no_defs <> +<s-maroc> # Sud Maroc Grid + proj=lcc ellps=clrk80 lon_0=5d24W lat_0=29d42'N + x_0=500000 y_0=300000 k_0=0.999615596 + no_defs <> +<s-tunis> # Sud Tunisie Grid + proj=lcc ellps=clrk80 lon_0=9d54'E lat_0=33d18'N + x_0=500000 y_0=300000 k_0=0.999625769 + no_defs <> diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 00000000..338a7f2b --- /dev/null +++ b/src/Makefile @@ -0,0 +1,128 @@ +# Generated automatically from Makefile.in by configure. +# SCCSID--- @(#)Makefile.in 4.8 94/02/27 GIE REL" + +prefix = /usr/local +exec_prefix = $(prefix) + +CC = gcc + +INSTALL = @INSTALL@ + +RANLIB = ranlib + +DEFS = -DHAVE_STRERROR=1 -DHAVE_LIBM=1 + +LIBS = -lm + +PJ_ADDL = + +LIB_DIR_NAME = proj.4 + +bindir = $(exec_prefix)/bin +libdir = $(exec_prefix)/lib +incdir = $(exec_prefix)/include + +LDEF = -DPROJ_LIB=\"$(libdir)/$(LIB_DIR_NAME)\" + +CFLAGS = -g -I./ $(DEFS) $(LDEF) + +SHELL = /bin/sh + +L = libproj.a + +.PRECIOUS: $L + +azimuthal = \ + $L(PJ_aeqd.o) $L(PJ_gnom.o) $L(PJ_laea.o) $L(PJ_mod_ster.o) \ + $L(PJ_nsper.o) $L(PJ_nzmg.o) $L(PJ_ortho.o) $L(PJ_stere.o) + +conic = \ + $L(PJ_aea.o) $L(PJ_bipc.o) $L(PJ_bonne.o) $L(PJ_eqdc.o) \ + $L(PJ_imw_p.o) $L(PJ_lcc.o) $L(PJ_mpoly.o) $L(PJ_poly.o) \ + $L(PJ_rpoly.o) $L(PJ_sconics.o) + +cylinder = \ + $L(PJ_cass.o) $L(PJ_cc.o) $L(PJ_cea.o) $L(PJ_eqc.o) \ + $L(PJ_gall.o) $L(PJ_labrd.o) $L(PJ_lsat.o) $L(PJ_merc.o) \ + $L(PJ_mill.o) $L(PJ_ocea.o) $L(PJ_omerc.o) $L(PJ_somerc.o) \ + $L(PJ_tcc.o) $L(PJ_tcea.o) $L(PJ_tmerc.o) + +misc = \ + $L(PJ_airy.o) $L(PJ_aitoff.o) $L(PJ_august.o) $L(PJ_bacon.o) \ + $L(PJ_chamb.o) $L(PJ_hammer.o) $L(PJ_lagrng.o) $L(PJ_larr.o) \ + $L(PJ_lask.o) $L(PJ_nocol.o) $L(PJ_ob_tran.o) $L(PJ_oea.o) \ + $L(PJ_tpeqd.o) $L(PJ_vandg.o) $L(PJ_vandg2.o) $L(PJ_vandg4.o) \ + $L(PJ_wag7.o) + +pseudo = \ + $L(PJ_boggs.o) $L(PJ_collg.o) $L(PJ_crast.o) $L(PJ_denoy.o) \ + $L(PJ_eck1.o) $L(PJ_eck2.o) $L(PJ_eck3.o) $L(PJ_eck4.o) \ + $L(PJ_eck5.o) $L(PJ_fahey.o) $L(PJ_fouc_s.o) $L(PJ_gins8.o) \ + $L(PJ_gn_sinu.o) $L(PJ_goode.o) $L(PJ_hatano.o) $L(PJ_loxim.o) \ + $L(PJ_mbt_fps.o) $L(PJ_mbtfpp.o) $L(PJ_mbtfpq.o) $L(PJ_moll.o) \ + $L(PJ_nell.o) $L(PJ_nell_h.o) $L(PJ_putp2.o) $L(PJ_putp3.o) \ + $L(PJ_putp4p.o) $L(PJ_putp5.o) $L(PJ_putp6.o) $L(PJ_robin.o) \ + $L(PJ_sts.o) $L(PJ_urm5.o) $L(PJ_urmfps.o) $L(PJ_wag2.o) \ + $L(PJ_wag3.o) $L(PJ_wink1.o) $L(PJ_wink2.o) + +support = \ + $L(aasincos.o) $L(adjlon.o) $L(bch2bps.o) $L(bchgen.o) \ + $L(biveval.o) $L(dmstor.o) $L(mk_cheby.o) $L(pj_auth.o) \ + $L(pj_deriv.o) $L(pj_ell_set.o) $L(pj_ellps.o) $L(pj_errno.o) \ + $L(pj_factors.o) $L(pj_fwd.o) $L(pj_init.o) $L(pj_inv.o) \ + $L(pj_list.o) $L(pj_malloc.o) $L(pj_mlfn.o) $L(pj_msfn.o) \ + $L(pj_open_lib.o) $L(pj_param.o) $L(pj_phi2.o) $L(pj_pr_list.o) \ + $L(pj_qsfn.o) $L(pj_strerrno.o) $L(pj_tsfn.o) $L(pj_units.o) \ + $L(pj_zpoly1.o) $L(rtodms.o) $L(vector1.o) + +LLIST = $(azimuthal) $(conic) $(cylinder) $(misc) $(pseudo) $(support) + +# Second part of export Makefile +# SCCSID--- @(#)Make.2 4.7 95/09/23 GIE REL" + +all: libproj proj geod nad2nad nad2bin + +PROJ.o = proj.o gen_cheb.o p_series.o emess.o + +proj: $(PROJ.o) $L + $(CC) -o $@ $(PROJ.o) $L $(LIBS) + +NAD2NAD.o = nad2nad.o nad_cvt.o nad_init.o nad_intr.o emess.o + +nad2nad: $(NAD2NAD.o) $L + $(CC) -o $@ $(NAD2NAD.o) $L $(LIBS) + +nad2nad: nad_list.h + +nad2bin: nad2bin.o + $(CC) -o $@ nad2bin.o $(LIBS) + +RLIB = $L(pj_release.o) + +libproj: $(RLIB) $(LLIST) $(PJ_ADDL) + $(RANLIB) $L + +GEOD.o = geod.o geod_set.o geod_for.o geod_inv.o emess.o + +geod: $(GEOD.o) $L + $(CC) -o $@ $(GEOD.o) $L $(LIBS) + +install: all + cp proj geod nad2nad $(bindir) + chmod 755 $(bindir)/proj $(bindir)/geod $(bindir)/nad2nad + cp projects.h $(incdir) + chmod 644 $(incdir)/projects.h + cp libproj.a $(libdir) + chmod 644 $(libdir)/libproj.a + $(RANLIB) $(libdir)/libproj.a + +clean: + /bin/rm -f core *.o + +$(GEOD.o): geodesic.h + +$(RLIB) : projects.h pj_list.h + +nad2nad.o geod.o proj.o: emess.h projects.h + +nad2bin.o: projects.h diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 00000000..8fd9b763 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,127 @@ +# SCCSID--- @(#)Makefile.in 4.8 94/02/27 GIE REL" + +prefix = /usr/local +exec_prefix = $(prefix) + +CC = @CC@ + +INSTALL = @INSTALL@ + +RANLIB = @RANLIB@ + +DEFS = @DEFS@ + +LIBS = @LIBS@ + +PJ_ADDL = @PJ_ADDL@ + +LIB_DIR_NAME = @LIB_DIR@ + +bindir = $(exec_prefix)/bin +libdir = $(exec_prefix)/lib +incdir = $(exec_prefix)/include + +LDEF = -DPROJ_LIB=\"$(libdir)/$(LIB_DIR_NAME)\" + +CFLAGS = -O -I./ $(DEFS) $(LDEF) + +SHELL = /bin/sh + +L = libproj.a + +.PRECIOUS: $L + +azimuthal = \ + $L(PJ_aeqd.o) $L(PJ_gnom.o) $L(PJ_laea.o) $L(PJ_mod_ster.o) \ + $L(PJ_nsper.o) $L(PJ_nzmg.o) $L(PJ_ortho.o) $L(PJ_stere.o) + +conic = \ + $L(PJ_aea.o) $L(PJ_bipc.o) $L(PJ_bonne.o) $L(PJ_eqdc.o) \ + $L(PJ_imw_p.o) $L(PJ_lcc.o) $L(PJ_mpoly.o) $L(PJ_poly.o) \ + $L(PJ_rpoly.o) $L(PJ_sconics.o) + +cylinder = \ + $L(PJ_cass.o) $L(PJ_cc.o) $L(PJ_cea.o) $L(PJ_eqc.o) \ + $L(PJ_gall.o) $L(PJ_labrd.o) $L(PJ_lsat.o) $L(PJ_merc.o) \ + $L(PJ_mill.o) $L(PJ_ocea.o) $L(PJ_omerc.o) $L(PJ_somerc.o) \ + $L(PJ_tcc.o) $L(PJ_tcea.o) $L(PJ_tmerc.o) + +misc = \ + $L(PJ_airy.o) $L(PJ_aitoff.o) $L(PJ_august.o) $L(PJ_bacon.o) \ + $L(PJ_chamb.o) $L(PJ_hammer.o) $L(PJ_lagrng.o) $L(PJ_larr.o) \ + $L(PJ_lask.o) $L(PJ_nocol.o) $L(PJ_ob_tran.o) $L(PJ_oea.o) \ + $L(PJ_tpeqd.o) $L(PJ_vandg.o) $L(PJ_vandg2.o) $L(PJ_vandg4.o) \ + $L(PJ_wag7.o) + +pseudo = \ + $L(PJ_boggs.o) $L(PJ_collg.o) $L(PJ_crast.o) $L(PJ_denoy.o) \ + $L(PJ_eck1.o) $L(PJ_eck2.o) $L(PJ_eck3.o) $L(PJ_eck4.o) \ + $L(PJ_eck5.o) $L(PJ_fahey.o) $L(PJ_fouc_s.o) $L(PJ_gins8.o) \ + $L(PJ_gn_sinu.o) $L(PJ_goode.o) $L(PJ_hatano.o) $L(PJ_loxim.o) \ + $L(PJ_mbt_fps.o) $L(PJ_mbtfpp.o) $L(PJ_mbtfpq.o) $L(PJ_moll.o) \ + $L(PJ_nell.o) $L(PJ_nell_h.o) $L(PJ_putp2.o) $L(PJ_putp3.o) \ + $L(PJ_putp4p.o) $L(PJ_putp5.o) $L(PJ_putp6.o) $L(PJ_robin.o) \ + $L(PJ_sts.o) $L(PJ_urm5.o) $L(PJ_urmfps.o) $L(PJ_wag2.o) \ + $L(PJ_wag3.o) $L(PJ_wink1.o) $L(PJ_wink2.o) + +support = \ + $L(aasincos.o) $L(adjlon.o) $L(bch2bps.o) $L(bchgen.o) \ + $L(biveval.o) $L(dmstor.o) $L(mk_cheby.o) $L(pj_auth.o) \ + $L(pj_deriv.o) $L(pj_ell_set.o) $L(pj_ellps.o) $L(pj_errno.o) \ + $L(pj_factors.o) $L(pj_fwd.o) $L(pj_init.o) $L(pj_inv.o) \ + $L(pj_list.o) $L(pj_malloc.o) $L(pj_mlfn.o) $L(pj_msfn.o) \ + $L(pj_open_lib.o) $L(pj_param.o) $L(pj_phi2.o) $L(pj_pr_list.o) \ + $L(pj_qsfn.o) $L(pj_strerrno.o) $L(pj_tsfn.o) $L(pj_units.o) \ + $L(pj_zpoly1.o) $L(rtodms.o) $L(vector1.o) + +LLIST = $(azimuthal) $(conic) $(cylinder) $(misc) $(pseudo) $(support) + +# Second part of export Makefile +# SCCSID--- @(#)Make.2 4.7 95/09/23 GIE REL" + +all: @PROGS@ + +PROJ.o = proj.o gen_cheb.o p_series.o emess.o + +proj: $(PROJ.o) $L + $(CC) -o $@ $(PROJ.o) $L $(LIBS) + +NAD2NAD.o = nad2nad.o nad_cvt.o nad_init.o nad_intr.o emess.o + +nad2nad: $(NAD2NAD.o) $L + $(CC) -o $@ $(NAD2NAD.o) $L $(LIBS) + +nad2nad: nad_list.h + +nad2bin: nad2bin.o + $(CC) -o $@ nad2bin.o $(LIBS) + +RLIB = $L(pj_release.o) + +libproj: $(RLIB) $(LLIST) $(PJ_ADDL) + $(RANLIB) $L + +GEOD.o = geod.o geod_set.o geod_for.o geod_inv.o emess.o + +geod: $(GEOD.o) $L + $(CC) -o $@ $(GEOD.o) $L $(LIBS) + +install: all + cp proj geod nad2nad $(bindir) + chmod 755 $(bindir)/proj $(bindir)/geod $(bindir)/nad2nad + cp projects.h $(incdir) + chmod 644 $(incdir)/projects.h + cp libproj.a $(libdir) + chmod 644 $(libdir)/libproj.a + $(RANLIB) $(libdir)/libproj.a + +clean: + /bin/rm -f core *.o + +$(GEOD.o): geodesic.h + +$(RLIB) : projects.h pj_list.h + +nad2nad.o geod.o proj.o: emess.h projects.h + +nad2bin.o: projects.h diff --git a/src/PJ_aea.c b/src/PJ_aea.c new file mode 100644 index 00000000..6ad5e9f0 --- /dev/null +++ b/src/PJ_aea.c @@ -0,0 +1,131 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_aea.c 4.2 94/03/18 GIE REL"; +#endif +# define EPS10 1.e-10 +# define TOL7 1.e-7 +#define PROJ_PARMS__ \ + double ec; \ + double n; \ + double c; \ + double dd; \ + double n2; \ + double rho0; \ + double rho; \ + double phi1; \ + double phi2; \ + double *en; \ + int ellips; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(aea, "Albers Equal Area") + "\n\tConic Sph&Ell\n\tlat_1= lat_2="; +PROJ_HEAD(leac, "Lambert Equal Area Conic") + "\n\tConic, Sph&Ell\n\tlat_1= south"; +/* determine latitude angle phi-1 */ +# define N_ITER 15 +# define EPSILON 1.0e-7 +# define TOL 1.0e-10 + static double +phi1_(double qs, double Te, double Tone_es) { + int i; + double Phi, sinpi, cospi, con, com, dphi; + + Phi = asin (.5 * qs); + if (Te < EPSILON) + return( Phi ); + i = N_ITER; + do { + sinpi = sin (Phi); + cospi = cos (Phi); + con = Te * sinpi; + com = 1. - con * con; + dphi = .5 * com * com / cospi * (qs / Tone_es - + sinpi / com + .5 / Te * log ((1. - con) / + (1. + con))); + Phi += dphi; + } while (fabs(dphi) > TOL && --i); + return( i ? Phi : HUGE_VAL ); +} +FORWARD(e_forward); /* ellipsoid & spheroid */ + if ((P->rho = P->c - (P->ellips ? P->n * pj_qsfn(sin(lp.phi), + P->e, P->one_es) : P->n2 * sin(lp.phi))) < 0.) F_ERROR + P->rho = P->dd * sqrt(P->rho); + xy.x = P->rho * sin( lp.lam *= P->n ); + xy.y = P->rho0 - P->rho * cos(lp.lam); + return (xy); +} +INVERSE(e_inverse) /* ellipsoid & spheroid */; + if (P->rho = hypot(xy.x, xy.y = P->rho0 - xy.y)) { + if (P->n < 0.) { + P->rho = -P->rho; + xy.x = -xy.x; + xy.y = -xy.y; + } + lp.phi = P->rho / P->dd; + if (P->ellips) { + lp.phi = (P->c - lp.phi * lp.phi) / P->n; + if (fabs(P->ec - fabs(lp.phi)) > TOL7) { + if ((lp.phi = phi1_(lp.phi, P->e, P->one_es)) == HUGE_VAL) + I_ERROR + } else + lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + } else if (fabs(lp.phi = (P->c - lp.phi * lp.phi) / P->n2) <= 1.) + lp.phi = asin(lp.phi); + else + lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + lp.lam = atan2(xy.x, xy.y) / P->n; + } else { + lp.lam = 0.; + lp.phi = P->n > 0. ? HALFPI : - HALFPI; + } + return (lp); +} +FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } + static PJ * +setup(PJ *P) { + double cosphi, sinphi; + int secant; + + if (fabs(P->phi1 + P->phi2) < EPS10) E_ERROR(-21); + P->n = sinphi = sin(P->phi1); + cosphi = cos(P->phi1); + secant = fabs(P->phi1 - P->phi2) >= EPS10; + if (P->ellips = P->es > 0.) { + double ml1, m1; + + if (!(P->en = pj_enfn(P->es))) E_ERROR_0; + m1 = pj_msfn(sinphi, cosphi, P->es); + ml1 = pj_qsfn(sinphi, P->e, P->one_es); + if (secant) { /* secant cone */ + double ml2, m2; + + sinphi = sin(P->phi2); + cosphi = cos(P->phi2); + m2 = pj_msfn(sinphi, cosphi, P->es); + ml2 = pj_qsfn(sinphi, P->e, P->one_es); + P->n = (m1 * m1 - m2 * m2) / (ml2 - ml1); + } + P->ec = 1. - .5 * P->one_es * log((1. - P->e) / + (1. + P->e)) / P->e; + P->c = m1 * m1 + P->n * ml1; + P->dd = 1. / P->n; + P->rho0 = P->dd * sqrt(P->c - P->n * pj_qsfn(sin(P->phi0), + P->e, P->one_es)); + } else { + if (secant) P->n = .5 * (P->n + sin(P->phi2)); + P->n2 = P->n + P->n; + P->c = cosphi * cosphi + P->n2 * sinphi; + P->dd = 1. / P->n; + P->rho0 = P->dd * sqrt(P->c - P->n2 * sin(P->phi0)); + } + P->inv = e_inverse; P->fwd = e_forward; + return P; +} +ENTRY0(aea) + P->phi1 = pj_param(P->params, "rlat_1").f; + P->phi2 = pj_param(P->params, "rlat_2").f; +ENDENTRY(setup(P)) +ENTRY0(leac) + P->phi2 = pj_param(P->params, "rlat_1").f; + P->phi1 = pj_param(P->params, "bsouth").i ? - HALFPI: HALFPI; +ENDENTRY(setup(P)) diff --git a/src/PJ_aeqd.c b/src/PJ_aeqd.c new file mode 100644 index 00000000..95f98722 --- /dev/null +++ b/src/PJ_aeqd.c @@ -0,0 +1,241 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_aeqd.c 4.3 94/11/03 GIE REL"; +#endif +#define EPS10 1.e-10 +#define TOL 1.e-14 +#define PROJ_PARMS__ \ + double sinph0; \ + double cosph0; \ + double *en; \ + double M1; \ + double N1; \ + double Mp; \ + double He; \ + double G; \ + int mode; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(aeqd, "Azimuthal Equidistant") "\n\tAzi, Sph&Ell\n\tlat_0 guam"; +#define N_POLE 0 +#define S_POLE 1 +#define EQUIT 2 +#define OBLIQ 3 +FORWARD(e_guam_fwd); /* Guam elliptical */ + double cosphi, sinphi, t; + + cosphi = cos(lp.phi); + sinphi = sin(lp.phi); + t = 1. / sqrt(1. - P->es * sinphi * sinphi); + xy.x = lp.lam * cosphi * t; + xy.y = pj_mlfn(lp.phi, sinphi, cosphi, P->en) - P->M1 + + .5 * lp.lam * lp.lam * cosphi * sinphi * t; + return (xy); +} +FORWARD(e_forward); /* elliptical */ + double coslam, cosphi, sinphi, rho, s, H, H2, c, Az, t, ct, st, cA, sA; + + coslam = cos(lp.lam); + cosphi = cos(lp.phi); + sinphi = sin(lp.phi); + switch (P->mode) { + case N_POLE: + coslam = - coslam; + case S_POLE: + xy.x = (rho = fabs(P->Mp - pj_mlfn(lp.phi, sinphi, cosphi, P->en))) * + sin(lp.lam); + xy.y = rho * coslam; + break; + case EQUIT: + case OBLIQ: + if (fabs(lp.lam) < EPS10 && fabs(lp.phi - P->phi0) < EPS10) { + xy.x = xy.y = 0.; + break; + } + t = atan2(P->one_es * sinphi + P->es * P->N1 * P->sinph0 * + sqrt(1. - P->es * sinphi * sinphi), cosphi); + ct = cos(t); st = sin(t); + Az = atan2(sin(lp.lam) * ct, P->cosph0 * st - P->sinph0 * coslam * ct); + cA = cos(Az); sA = sin(Az); + s = aasin( fabs(sA) < TOL ? + (P->cosph0 * st - P->sinph0 * coslam * ct) / cA : + sin(lp.lam) * ct / sA ); + H = P->He * cA; + H2 = H * H; + c = P->N1 * s * (1. + s * s * (- H2 * (1. - H2)/6. + + s * ( P->G * H * (1. - 2. * H2 * H2) / 8. + + s * ((H2 * (4. - 7. * H2) - 3. * P->G * P->G * (1. - 7. * H2)) / + 120. - s * P->G * H / 48.)))); + xy.x = c * sA; + xy.y = c * cA; + break; + } + return (xy); +} +FORWARD(s_forward); /* spherical */ + double coslam, cosphi, sinphi; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + switch (P->mode) { + case EQUIT: + xy.y = cosphi * coslam; + goto oblcon; + case OBLIQ: + xy.y = P->sinph0 * sinphi + P->cosph0 * cosphi * coslam; +oblcon: + if (fabs(fabs(xy.y) - 1.) < TOL) + if (xy.y < 0.) + F_ERROR + else + xy.x = xy.y = 0.; + else { + xy.y = acos(xy.y); + xy.y /= sin(xy.y); + xy.x = xy.y * cosphi * sin(lp.lam); + xy.y *= (P->mode == EQUIT) ? sinphi : + P->cosph0 * sinphi - P->sinph0 * cosphi * coslam; + } + break; + case N_POLE: + lp.phi = -lp.phi; + coslam = -coslam; + case S_POLE: + if (fabs(lp.phi - HALFPI) < EPS10) F_ERROR; + xy.x = (xy.y = (HALFPI + lp.phi)) * sin(lp.lam); + xy.y *= coslam; + break; + } + return (xy); +} +INVERSE(e_guam_inv); /* Guam elliptical */ + double x2, t; + int i; + + x2 = 0.5 * xy.x * xy.x; + lp.phi = P->phi0; + for (i = 0; i < 3; ++i) { + t = P->e * sin(lp.phi); + lp.phi = pj_inv_mlfn(P->M1 + xy.y - + x2 * tan(lp.phi) * (t = sqrt(1. - t * t)), P->es, P->en); + } + lp.lam = xy.x * t / cos(lp.phi); + return (lp); +} +INVERSE(e_inverse); /* elliptical */ + double c, Az, cosAz, A, B, D, E, F, psi, t; + int i; + + if ((c = hypot(xy.x, xy.y)) < EPS10) { + lp.phi = P->phi0; + lp.lam = 0.; + return (lp); + } + if (P->mode == OBLIQ || P->mode == EQUIT) { + cosAz = cos(Az = atan2(xy.x, xy.y)); + t = P->cosph0 * cosAz; + B = P->es * t / P->one_es; + A = - B * t; + B *= 3. * (1. - A) * P->sinph0; + D = c / P->N1; + E = D * (1. - D * D * (A * (1. + A) / 6. + B * (1. + 3.*A) * D / 24.)); + F = 1. - E * E * (A / 2. + B * E / 6.); + psi = aasin(P->sinph0 * cos(E) + t * sin(E)); + lp.lam = aasin(sin(Az) * sin(E) / cos(psi)); + if ((t = fabs(psi)) < EPS10) + lp.phi = 0.; + else if (fabs(t - HALFPI) < 0.) + lp.phi = HALFPI; + else + lp.phi = atan((1. - P->es * F * P->sinph0 / sin(psi)) * tan(psi) / + P->one_es); + } else { /* Polar */ + lp.phi = pj_inv_mlfn(P->mode == N_POLE ? P->Mp - c : P->Mp + c, + P->es, P->en); + lp.lam = atan2(xy.x, P->mode == N_POLE ? -xy.y : xy.y); + } + return (lp); +} +INVERSE(s_inverse); /* spherical */ + double cosc, c_rh, sinc; + + if ((c_rh = hypot(xy.x, xy.y)) > PI) { + if (c_rh - EPS10 > PI) I_ERROR; + c_rh = PI; + } else if (c_rh < EPS10) { + lp.phi = P->phi0; + lp.lam = 0.; + return (lp); + } + if (P->mode == OBLIQ || P->mode == EQUIT) { + sinc = sin(c_rh); + cosc = cos(c_rh); + if (P->mode == EQUIT) { + lp.phi = aasin(xy.y * sinc / c_rh); + xy.x *= sinc; + xy.y = cosc * c_rh; + } else { + lp.phi = aasin(cosc * P->sinph0 + xy.y * sinc * P->cosph0 / + c_rh); + xy.y = (cosc - P->sinph0 * sin(lp.phi)) * c_rh; + xy.x *= sinc * P->cosph0; + } + lp.lam = xy.y == 0. ? 0. : atan2(xy.x, xy.y); + } else if (P->mode == N_POLE) { + lp.phi = HALFPI - c_rh; + lp.lam = atan2(xy.x, -xy.y); + } else { + lp.phi = c_rh - HALFPI; + lp.lam = atan2(xy.x, xy.y); + } + return (lp); +} +FREEUP; + if (P) { + if (P->en) + pj_dalloc(P->en); + pj_dalloc(P); + } +} +ENTRY1(aeqd, en) + P->phi0 = pj_param(P->params, "rlat_0").f; + if (fabs(fabs(P->phi0) - HALFPI) < EPS10) { + P->mode = P->phi0 < 0. ? S_POLE : N_POLE; + P->sinph0 = P->phi0 < 0. ? -1. : 1.; + P->cosph0 = 0.; + } else if (fabs(P->phi0) < EPS10) { + P->mode = EQUIT; + P->sinph0 = 0.; + P->cosph0 = 1.; + } else { + P->mode = OBLIQ; + P->sinph0 = sin(P->phi0); + P->cosph0 = cos(P->phi0); + } + if (! P->es) { + P->inv = s_inverse; P->fwd = s_forward; + } else { + if (!(P->en = pj_enfn(P->es))) E_ERROR_0; + if (pj_param(P->params, "bguam").i) { + P->M1 = pj_mlfn(P->phi0, P->sinph0, P->cosph0, P->en); + P->inv = e_guam_inv; P->fwd = e_guam_fwd; + } else { + switch (P->mode) { + case N_POLE: + P->Mp = pj_mlfn(HALFPI, 1., 0., P->en); + break; + case S_POLE: + P->Mp = pj_mlfn(-HALFPI, -1., 0., P->en); + break; + case EQUIT: + case OBLIQ: + P->inv = e_inverse; P->fwd = e_forward; + P->N1 = 1. / sqrt(1. - P->es * P->sinph0 * P->sinph0); + P->G = P->sinph0 * (P->He = P->e / sqrt(P->one_es)); + P->He *= P->cosph0; + break; + } + P->inv = e_inverse; P->fwd = e_forward; + } + } +ENDENTRY(P) diff --git a/src/PJ_airy.c b/src/PJ_airy.c new file mode 100644 index 00000000..52bce088 --- /dev/null +++ b/src/PJ_airy.c @@ -0,0 +1,94 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_airy.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double p_halfpi; \ + double sinph0; \ + double cosph0; \ + double Cb; \ + int mode; \ + int no_cut; /* do not cut at hemisphere limit */ +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(airy, "Airy") "\n\tMisc Sph, no inv.\n\tno_cut lat_b="; +# define EPS 1.e-10 +# define N_POLE 0 +# define S_POLE 1 +# define EQUIT 2 +# define OBLIQ 3 +FORWARD(s_forward); /* spheroid */ + double sinlam, coslam, cosphi, sinphi, t, s, Krho, cosz; + + sinlam = sin(lp.lam); + coslam = cos(lp.lam); + switch (P->mode) { + case EQUIT: + case OBLIQ: + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + cosz = cosphi * coslam; + if (P->mode == OBLIQ) + cosz = P->sinph0 * sinphi + P->cosph0 * cosz; + if (!P->no_cut && cosz < -EPS) + F_ERROR; + if (fabs(s = 1. - cosz) > EPS) { + t = 0.5 * (1. + cosz); + Krho = -log(t)/s - P->Cb / t; + } else + Krho = 0.5 - P->Cb; + xy.x = Krho * cosphi * sinlam; + if (P->mode == OBLIQ) + xy.y = Krho * (P->cosph0 * sinphi - + P->sinph0 * cosphi * coslam); + else + xy.y = Krho * sinphi; + break; + case S_POLE: + case N_POLE: + lp.phi = fabs(P->p_halfpi - lp.phi); + if (!P->no_cut && (lp.phi - EPS) > HALFPI) + F_ERROR; + if ((lp.phi *= 0.5) > EPS) { + t = tan(lp.phi); + Krho = -2.*(log(cos(lp.phi)) / t + t * P->Cb); + xy.x = Krho * sinlam; + xy.y = Krho * coslam; + if (P->mode == N_POLE) + xy.y = -xy.y; + } else + xy.x = xy.y = 0.; + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(airy) + double beta; + + P->no_cut = pj_param(P->params, "bno_cut").i; + beta = 0.5 * (HALFPI - pj_param(P->params, "rlat_b").f); + if (fabs(beta) < EPS) + P->Cb = -0.5; + else { + P->Cb = 1./tan(beta); + P->Cb *= P->Cb * log(cos(beta)); + } + if (fabs(fabs(P->phi0) - HALFPI) < EPS) + if (P->phi0 < 0.) { + P->p_halfpi = -HALFPI; + P->mode = S_POLE; + } else { + P->p_halfpi = HALFPI; + P->mode = N_POLE; + } + else { + if (fabs(P->phi0) < EPS) + P->mode = EQUIT; + else { + P->mode = OBLIQ; + P->sinph0 = sin(P->phi0); + P->cosph0 = cos(P->phi0); + } + } + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_aitoff.c b/src/PJ_aitoff.c new file mode 100644 index 00000000..37e89a81 --- /dev/null +++ b/src/PJ_aitoff.c @@ -0,0 +1,43 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_aitoff.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double cosphi1; \ + int mode; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(aitoff, "Aitoff") "\n\tMisc Sph"; +PROJ_HEAD(wintri, "Winkel Tripel") "\n\tMisc Sph\n\tlat_1"; +FORWARD(s_forward); /* spheroid */ + double c, d; + + if (d = acos(cos(lp.phi) * cos(c = 0.5 * lp.lam))) { /* basic Aitoff */ + xy.x = 2. * d * cos(lp.phi) * sin(c) * (xy.y = 1. / sin(d)); + xy.y *= d * sin(lp.phi); + } else + xy.x = xy.y = 0.; + if (P->mode) { /* Winkel Tripel */ + xy.x = (xy.x + lp.lam * P->cosphi1) * 0.5; + xy.y = (xy.y + lp.phi) * 0.5; + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->inv = 0; + P->fwd = s_forward; + P->es = 0.; + return P; +} +ENTRY0(aitoff) + P->mode = 0; +ENDENTRY(setup(P)) +ENTRY0(wintri) + P->mode = 1; + if (pj_param(P->params, "tlat_1").i) + if ((P->cosphi1 = cos(pj_param(P->params, "rlat_1").f)) == 0.) + E_ERROR(-22) + else /* 50d28' or acos(2/pi) */ + P->cosphi1 = 0.636619772367581343; +ENDENTRY(setup(P)) diff --git a/src/PJ_august.c b/src/PJ_august.c new file mode 100644 index 00000000..ca870b2f --- /dev/null +++ b/src/PJ_august.c @@ -0,0 +1,21 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_august.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(august, "August Epicycloidal") "\n\tMisc Sph, no inv."; +#define M 1.333333333333333 +FORWARD(s_forward); /* spheroid */ + double t, c1, c, x1, x12, y1, y12; + + t = tan(.5 * lp.phi); + c1 = sqrt(1. - t * t); + c = 1. + c1 * cos(lp.lam *= .5); + x1 = sin(lp.lam) * c1 / c; + y1 = t / c; + xy.x = M * x1 * (3. + (x12 = x1 * x1) - 3. * (y12 = y1 * y1)); + xy.y = M * y1 * (3. + 3. * x12 - y12); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(august) P->inv = 0; P->fwd = s_forward; P->es = 0.; ENDENTRY(P) diff --git a/src/PJ_bacon.c b/src/PJ_bacon.c new file mode 100644 index 00000000..ab785d2d --- /dev/null +++ b/src/PJ_bacon.c @@ -0,0 +1,44 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_bacon.c 4.1 94/02/15 GIE REL"; +#endif +# define HLFPI2 2.46740110027233965467 +# define EPS 1e-10 +#define PROJ_PARMS__ \ + int bacn; \ + int ortl; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(apian, "Apian Globular I") "\n\tMisc Sph, no inv."; +PROJ_HEAD(ortel, "Ortelius Oval") "\n\tMisc Sph, no inv."; +PROJ_HEAD(bacon, "Bacon Globular") "\n\tMisc Sph, no inv."; +FORWARD(s_forward); /* spheroid */ + double ax, f; + + xy.y = P->bacn ? HALFPI * sin(lp.phi) : lp.phi; + if ((ax = fabs(lp.lam)) >= EPS) { + if (P->ortl && ax >= HALFPI) + xy.x = sqrt(HLFPI2 - lp.phi * lp.phi + EPS) + ax - HALFPI; + else { + f = 0.5 * (HLFPI2 / ax + ax); + xy.x = ax - f + sqrt(f * f - xy.y * xy.y); + } + if (lp.lam < 0.) xy.x = - xy.x; + } else + xy.x = 0.; + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(bacon) + P->bacn = 1; + P->ortl = 0; + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) +ENTRY0(apian) + P->bacn = P->ortl = 0; + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) +ENTRY0(ortel) + P->bacn = 0; + P->ortl = 1; + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_bipc.c b/src/PJ_bipc.c new file mode 100644 index 00000000..dd3fae8d --- /dev/null +++ b/src/PJ_bipc.c @@ -0,0 +1,135 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_bipc.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + int noskew; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(bipc, "Bipolar conic of western hemisphere") + "\n\tConic Sph."; +# define EPS 1e-10 +# define EPS10 1e-10 +# define ONEEPS 1.000000001 +# define NITER 10 +# define lamB -.34894976726250681539 +# define n .63055844881274687180 +# define F 1.89724742567461030582 +# define Azab .81650043674686363166 +# define Azba 1.82261843856185925133 +# define T 1.27246578267089012270 +# define rhoc 1.20709121521568721927 +# define cAzc .69691523038678375519 +# define sAzc .71715351331143607555 +# define C45 .70710678118654752469 +# define S45 .70710678118654752410 +# define C20 .93969262078590838411 +# define S20 -.34202014332566873287 +# define R110 1.91986217719376253360 +# define R104 1.81514242207410275904 +FORWARD(s_forward); /* spheroid */ + double cphi, sphi, tphi, t, al, Az, z, Av, cdlam, sdlam, r; + int tag; + + cphi = cos(lp.phi); + sphi = sin(lp.phi); + cdlam = cos(sdlam = lamB - lp.lam); + sdlam = sin(sdlam); + if (fabs(fabs(lp.phi) - HALFPI) < EPS10) { + Az = lp.phi < 0. ? PI : 0.; + tphi = HUGE_VAL; + } else { + tphi = sphi / cphi; + Az = atan2(sdlam , C45 * (tphi - cdlam)); + } + if (tag = (Az > Azba)) { + cdlam = cos(sdlam = lp.lam + R110); + sdlam = sin(sdlam); + z = S20 * sphi + C20 * cphi * cdlam; + if (fabs(z) > 1.) { + if (fabs(z) > ONEEPS) F_ERROR + else z = z < 0. ? -1. : 1.; + } else + z = acos(z); + if (tphi != HUGE_VAL) + Az = atan2(sdlam, (C20 * tphi - S20 * cdlam)); + Av = Azab; + xy.y = rhoc; + } else { + z = S45 * (sphi + cphi * cdlam); + if (fabs(z) > 1.) { + if (fabs(z) > ONEEPS) F_ERROR + else z = z < 0. ? -1. : 1.; + } else + z = acos(z); + Av = Azba; + xy.y = -rhoc; + } + if (z < 0.) F_ERROR; + r = F * (t = pow(tan(.5 * z), n)); + if ((al = .5 * (R104 - z)) < 0.) F_ERROR; + al = (t + pow(al, n)) / T; + if (fabs(al) > 1.) { + if (fabs(al) > ONEEPS) F_ERROR + else al = al < 0. ? -1. : 1.; + } else + al = acos(al); + if (fabs(t = n * (Av - Az)) < al) + r /= cos(al + (tag ? t : -t)); + xy.x = r * sin(t); + xy.y += (tag ? -r : r) * cos(t); + if (P->noskew) { + t = xy.x; + xy.x = -xy.x * cAzc - xy.y * sAzc; + xy.y = -xy.y * cAzc + t * sAzc; + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double t, r, rp, rl, al, z, fAz, Az, s, c, Av; + int neg, i; + + if (P->noskew) { + t = xy.x; + xy.x = -xy.x * cAzc + xy.y * sAzc; + xy.y = -xy.y * cAzc - t * sAzc; + } + if (neg = (xy.x < 0.)) { + xy.y = rhoc - xy.y; + s = S20; + c = C20; + Av = Azab; + } else { + xy.y += rhoc; + s = S45; + c = C45; + Av = Azba; + } + rl = rp = r = hypot(xy.x, xy.y); + fAz = fabs(Az = atan2(xy.x, xy.y)); + for (i = NITER; i ; --i) { + z = 2. * atan(pow(r / F,1 / n)); + al = acos((pow(tan(.5 * z), n) + + pow(tan(.5 * (R104 - z)), n)) / T); + if (fAz < al) + r = rp * cos(al + (neg ? Az : -Az)); + if (fabs(rl - r) < EPS) + break; + rl = r; + } + if (! i) I_ERROR; + Az = Av - Az / n; + lp.phi = asin(s * cos(z) + c * sin(z) * cos(Az)); + lp.lam = atan2(sin(Az), c / tan(z) - s * cos(Az)); + if (neg) + lp.lam -= R110; + else + lp.lam = lamB - lp.lam; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(bipc) + P->noskew = pj_param(P->params, "bns").i; + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_boggs.c b/src/PJ_boggs.c new file mode 100644 index 00000000..bcb806ec --- /dev/null +++ b/src/PJ_boggs.c @@ -0,0 +1,35 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_boggs.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(boggs, "Boggs Eumorphic") "\n\tPCyl., no inv., Sph."; +# define NITER 20 +# define EPS 1e-7 +# define ONETOL 1.000001 +# define FXC 2.00276 +# define FXC2 1.11072 +# define FYC 0.49931 +# define FYC2 1.41421356237309504880 +FORWARD(s_forward); /* spheroid */ + double theta, th1, c; + int i; + + theta = lp.phi; + if (fabs(fabs(lp.phi) - HALFPI) < EPS) + xy.x = 0.; + else { + c = sin(theta) * PI; + for (i = NITER; i; --i) { + theta -= th1 = (theta + sin(theta) - c) / + (1. + cos(theta)); + if (fabs(th1) < EPS) break; + } + theta *= 0.5; + xy.x = FXC * lp.lam / (1. / cos(lp.phi) + FXC2 / cos(theta)); + } + xy.y = FYC * (lp.phi + FYC2 * sin(theta)); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(boggs) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_bonne.c b/src/PJ_bonne.c new file mode 100644 index 00000000..2371b2ce --- /dev/null +++ b/src/PJ_bonne.c @@ -0,0 +1,88 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_bonne.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double phi1; \ + double cphi1; \ + double am1; \ + double m1; \ + double *en; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(bonne, "Bonne (Werner lat_1=90)") + "\n\tConic Sph&Ell\n\tlat_1="; +#define EPS10 1e-10 +FORWARD(e_forward); /* ellipsoid */ + double rh, E, c; + + rh = P->am1 + P->m1 - pj_mlfn(lp.phi, E = sin(lp.phi), c = cos(lp.phi), P->en); + E = c * lp.lam / (rh * sqrt(1. - P->es * E * E)); + xy.x = rh * sin(E); + xy.y = P->am1 - rh * cos(E); + return (xy); +} +FORWARD(s_forward); /* spheroid */ + double E, rh; + + rh = P->cphi1 + P->phi1 - lp.phi; + if (fabs(rh) > EPS10) { + xy.x = rh * sin(E = lp.lam * cos(lp.phi) / rh); + xy.y = P->cphi1 - rh * cos(E); + } else + xy.x = xy.y = 0.; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double rh; + + rh = hypot(xy.x, xy.y = P->cphi1 - xy.y); + lp.phi = P->cphi1 + P->phi1 - rh; + if (fabs(lp.phi) > HALFPI) I_ERROR; + if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) + lp.lam = 0.; + else + lp.lam = rh * atan2(xy.x, xy.y) / cos(lp.phi); + return (lp); +} +INVERSE(e_inverse); /* ellipsoid */ + double s, rh; + + rh = hypot(xy.x, xy.y = P->am1 - xy.y); + lp.phi = pj_inv_mlfn(P->am1 + P->m1 - rh, P->es, P->en); + if ((s = fabs(lp.phi)) < HALFPI) { + s = sin(lp.phi); + lp.lam = rh * atan2(xy.x, xy.y) * + sqrt(1. - P->es * s * s) / cos(lp.phi); + } else if (fabs(s - HALFPI) <= EPS10) + lp.lam = 0.; + else I_ERROR; + return (lp); +} +FREEUP; + if (P) { + if (P->en) + pj_dalloc(P->en); + pj_dalloc(P); + } +} +ENTRY1(bonne, en) + double c; + + P->phi1 = pj_param(P->params, "rlat_1").f; + if (fabs(P->phi1) < EPS10) E_ERROR(-23); + if (P->es) { + P->en = pj_enfn(P->es); + P->m1 = pj_mlfn(P->phi1, P->am1 = sin(P->phi1), + c = cos(P->phi1), P->en); + P->am1 = c / (sqrt(1. - P->es * P->am1 * P->am1) * P->am1); + P->inv = e_inverse; + P->fwd = e_forward; + } else { + if (fabs(P->phi1) + EPS10 >= HALFPI) + P->cphi1 = 0.; + else + P->cphi1 = 1. / tan(P->phi1); + P->inv = s_inverse; + P->fwd = s_forward; + } +ENDENTRY(P) diff --git a/src/PJ_cass.c b/src/PJ_cass.c new file mode 100644 index 00000000..f4ed2e19 --- /dev/null +++ b/src/PJ_cass.c @@ -0,0 +1,82 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_cass.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double m0; \ + double n; \ + double t; \ + double a1; \ + double c; \ + double r; \ + double dd; \ + double d2; \ + double a2; \ + double tn; \ + double *en; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(cass, "Cassini") "\n\tCyl, Sph&Ell"; +# define EPS10 1e-10 +# define C1 .16666666666666666666 +# define C2 .00833333333333333333 +# define C3 .04166666666666666666 +# define C4 .33333333333333333333 +# define C5 .06666666666666666666 +FORWARD(e_forward); /* ellipsoid */ + xy.y = pj_mlfn(lp.phi, P->n = sin(lp.phi), P->c = cos(lp.phi), P->en); + P->n = 1./sqrt(1. - P->es * P->n * P->n); + P->tn = tan(lp.phi); P->t = P->tn * P->tn; + P->a1 = lp.lam * P->c; + P->c *= P->es * P->c / (1 - P->es); + P->a2 = P->a1 * P->a1; + xy.x = P->n * P->a1 * (1. - P->a2 * P->t * + (C1 - (8. - P->t + 8. * P->c) * P->a2 * C2)); + xy.y -= P->m0 - P->n * P->tn * P->a2 * + (.5 + (5. - P->t + 6. * P->c) * P->a2 * C3); + return (xy); +} +FORWARD(s_forward); /* spheroid */ + xy.x = asin(cos(lp.phi) * sin(lp.lam)); + xy.y = atan2(tan(lp.phi) , cos(lp.lam)) - P->phi0; + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + double ph1; + + ph1 = pj_inv_mlfn(P->m0 + xy.y, P->es, P->en); + P->tn = tan(ph1); P->t = P->tn * P->tn; + P->n = sin(ph1); + P->r = 1. / (1. - P->es * P->n * P->n); + P->n = sqrt(P->r); + P->r *= (1. - P->es) * P->n; + P->dd = xy.x / P->n; + P->d2 = P->dd * P->dd; + lp.phi = ph1 - (P->n * P->tn / P->r) * P->d2 * + (.5 - (1. + 3. * P->t) * P->d2 * C3); + lp.lam = P->dd * (1. + P->t * P->d2 * + (-C4 + (1. + 3. * P->t) * P->d2 * C5)) / cos(ph1); + return (lp); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = asin(sin(P->dd = xy.y + P->phi0) * cos(xy.x)); + lp.lam = atan2(tan(xy.x), cos(P->dd)); + return (lp); +} +FREEUP; + if (P) { + if (P->en) + pj_dalloc(P->en); + pj_dalloc(P); + } +} +ENTRY1(cass, en) + if (P->es) { + if (!(P->en = pj_enfn(P->es))) E_ERROR_0; + P->m0 = pj_mlfn(P->phi0, sin(P->phi0), cos(P->phi0), P->en); + P->inv = e_inverse; + P->fwd = e_forward; + } else { + P->inv = s_inverse; + P->fwd = s_forward; + } +ENDENTRY(P) diff --git a/src/PJ_cc.c b/src/PJ_cc.c new file mode 100644 index 00000000..b578c476 --- /dev/null +++ b/src/PJ_cc.c @@ -0,0 +1,22 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_cc.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double ap; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(cc, "Central Cylindrical") "\n\tCyl, Sph"; +#define EPS10 1.e-10 +FORWARD(s_forward); /* spheroid */ + if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) F_ERROR; + xy.x = lp.lam; + xy.y = tan(lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = atan(xy.y); + lp.lam = xy.x; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(cc) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_cea.c b/src/PJ_cea.c new file mode 100644 index 00000000..4286d9a5 --- /dev/null +++ b/src/PJ_cea.c @@ -0,0 +1,64 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_cea.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double qp; \ + double *apa; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(cea, "Equal Area Cylindrical") "\n\tCyl, Sph&Ell\n\tlat_ts="; +# define EPS 1e-10 +FORWARD(e_forward); /* spheroid */ + xy.x = P->k0 * lp.lam; + xy.y = .5 * pj_qsfn(sin(lp.phi), P->e, P->one_es) / P->k0; + return (xy); +} +FORWARD(s_forward); /* spheroid */ + xy.x = P->k0 * lp.lam; + xy.y = sin(lp.phi) / P->k0; + return (xy); +} +INVERSE(e_inverse); /* spheroid */ + lp.phi = pj_authlat(asin( 2. * xy.y * P->k0 / P->qp), P->apa); + lp.lam = xy.x / P->k0; + return (lp); +} +INVERSE(s_inverse); /* spheroid */ + double t; + + if ((t = fabs(xy.y *= P->k0)) - EPS <= 1.) { + if (t >= 1.) + lp.phi = xy.y < 0. ? -HALFPI : HALFPI; + else + lp.phi = asin(xy.y); + lp.lam = xy.x / P->k0; + } else I_ERROR; + return (lp); +} +FREEUP; + if (P) { + if (P->apa) + pj_dalloc(P->apa); + pj_dalloc(P); + } +} +ENTRY1(cea, apa) + double t; + + if (pj_param(P->params, "tlat_ts").i && + (P->k0 = cos(t = pj_param(P->params, "rlat_ts").f)) < 0.) E_ERROR(-24) + else + t = 0.; + if (P->es) { + t = sin(t); + P->k0 /= sqrt(1. - P->es * t * t); + P->e = sqrt(P->es); + if (!(P->apa = pj_authset(P->es))) E_ERROR_0; + P->qp = pj_qsfn(1., P->e, P->one_es); + P->inv = e_inverse; + P->fwd = e_forward; + } else { + P->inv = s_inverse; + P->fwd = s_forward; + } +ENDENTRY(P) diff --git a/src/PJ_chamb.c b/src/PJ_chamb.c new file mode 100644 index 00000000..8526e480 --- /dev/null +++ b/src/PJ_chamb.c @@ -0,0 +1,115 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_chamb.c 4.1 94/02/15 GIE REL"; +#endif +typedef struct { double r, Az; } VECT; +#define PROJ_PARMS__ \ + struct { /* control point data */ \ + double phi, lam; \ + double cosphi, sinphi; \ + VECT v; \ + XY p; \ + double Az; \ + } c[3]; \ + XY p; \ + double beta_0, beta_1, beta_2; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(chamb, "Chamberlin Trimetric") "\n\tMisc Sph, no inv." +"\n\tlat_1= lon_1= lat_2= lon_2= lat_3= lon_3="; +#include <stdio.h> +#define THIRD 0.333333333333333333 +#define TOL 1e-9 + static VECT /* distance and azimuth from point 1 to point 2 */ +vect(double dphi, double c1, double s1, double c2, double s2, double dlam) { + VECT v; + double cdl, dp, dl; + + cdl = cos(dlam); + if (fabs(dphi) > 1. || fabs(dlam) > 1.) + v.r = aacos(s1 * s2 + c1 * c2 * cdl); + else { /* more accurate for smaller distances */ + dp = sin(.5 * dphi); + dl = sin(.5 * dlam); + v.r = 2. * aasin(sqrt(dp * dp + c1 * c2 * dl * dl)); + } + if (fabs(v.r) > TOL) + v.Az = atan2(c2 * sin(dlam), c1 * s2 - s1 * c2 * cdl); + else + v.r = v.Az = 0.; + return v; +} + static double /* law of cosines */ +lc(double b,double c,double a) { + return aacos(.5 * (b * b + c * c - a * a) / (b * c)); +} +FORWARD(s_forward); /* spheroid */ + double sinphi, cosphi, a; + VECT v[3]; + int i, j; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + for (i = 0; i < 3; ++i) { /* dist/azimiths from control */ + v[i] = vect(lp.phi - P->c[i].phi, P->c[i].cosphi, P->c[i].sinphi, + cosphi, sinphi, lp.lam - P->c[i].lam); + if ( ! v[i].r) + break; + v[i].Az = adjlon(v[i].Az - P->c[i].v.Az); + } + if (i < 3) /* current point at control point */ + xy = P->c[i].p; + else { /* point mean of intersepts */ + xy = P->p; + for (i = 0; i < 3; ++i) { + j = i == 2 ? 0 : i + 1; + a = lc(P->c[i].v.r, v[i].r, v[j].r); + if (v[i].Az < 0.) + a = -a; + if (! i) { /* coord comp unique to each arc */ + xy.x += v[i].r * cos(a); + xy.y -= v[i].r * sin(a); + } else if (i == 1) { + a = P->beta_1 - a; + xy.x -= v[i].r * cos(a); + xy.y -= v[i].r * sin(a); + } else { + a = P->beta_2 - a; + xy.x += v[i].r * cos(a); + xy.y += v[i].r * sin(a); + } + } + xy.x *= THIRD; /* mean of arc intercepts */ + xy.y *= THIRD; + } + return xy; +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(chamb) + int i, j; + char line[10]; + + for (i = 0; i < 3; ++i) { /* get control point locations */ + (void)sprintf(line, "rlat_%d", i+1); + P->c[i].phi = pj_param(P->params, line).f; + (void)sprintf(line, "rlon_%d", i+1); + P->c[i].lam = pj_param(P->params, line).f; + P->c[i].lam = adjlon(P->c[i].lam - P->lam0); + P->c[i].cosphi = cos(P->c[i].phi); + P->c[i].sinphi = sin(P->c[i].phi); + } + for (i = 0; i < 3; ++i) { /* inter ctl pt. distances and azimuths */ + j = i == 2 ? 0 : i + 1; + P->c[i].v = vect(P->c[j].phi - P->c[i].phi, P->c[i].cosphi, P->c[i].sinphi, + P->c[j].cosphi, P->c[j].sinphi, P->c[j].lam - P->c[i].lam); + if (! P->c[i].v.r) E_ERROR(-25); + /* co-linearity problem ignored for now */ + } + P->beta_0 = lc(P->c[0].v.r, P->c[2].v.r, P->c[1].v.r); + P->beta_1 = lc(P->c[0].v.r, P->c[1].v.r, P->c[2].v.r); + P->beta_2 = PI - P->beta_0; + P->p.y = 2. * (P->c[0].p.y = P->c[1].p.y = P->c[2].v.r * sin(P->beta_0)); + P->c[2].p.y = 0.; + P->c[0].p.x = - (P->c[1].p.x = 0.5 * P->c[0].v.r); + P->p.x = P->c[2].p.x = P->c[0].p.x + P->c[2].v.r * cos(P->beta_0); + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_collg.c b/src/PJ_collg.c new file mode 100644 index 00000000..9bcc24fa --- /dev/null +++ b/src/PJ_collg.c @@ -0,0 +1,32 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_collg.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(collg, "Collignon") "\n\tPCyl, Sph."; +#define FXC 1.12837916709551257390 +#define FYC 1.77245385090551602729 +#define ONEEPS 1.0000001 +FORWARD(s_forward); /* spheroid */ + if ((xy.y = 1. - sin(lp.phi)) <= 0.) + xy.y = 0.; + else + xy.y = sqrt(xy.y); + xy.x = FXC * lp.lam * xy.y; + xy.y = FYC * (1. - xy.y); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / FYC - 1.; + if (fabs(lp.phi = 1. - lp.phi * lp.phi) < 1.) + lp.phi = asin(lp.phi); + else if (fabs(lp.phi) > ONEEPS) I_ERROR + else lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + if ((lp.lam = 1. - sin(lp.phi)) <= 0.) + lp.lam = 0.; + else + lp.lam = xy.x / (FXC * sqrt(lp.lam)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(collg) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_crast.c b/src/PJ_crast.c new file mode 100644 index 00000000..a72203e8 --- /dev/null +++ b/src/PJ_crast.c @@ -0,0 +1,25 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_crast.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(crast, "Craster Parabolic (Putnins P4)") +"\n\tPCyl., Sph."; +#define XM 0.97720502380583984317 +#define RXM 1.02332670794648848847 +#define YM 3.06998012383946546542 +#define RYM 0.32573500793527994772 +#define THIRD 0.333333333333333333 +FORWARD(s_forward); /* spheroid */ + lp.phi *= THIRD; + xy.x = XM * lp.lam * (2. * cos(lp.phi + lp.phi) - 1.); + xy.y = YM * sin(lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = 3. * asin(xy.y * RYM); + lp.lam = xy.x * RXM / (2. * cos((lp.phi + lp.phi) * THIRD) - 1); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(crast) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_denoy.c b/src/PJ_denoy.c new file mode 100644 index 00000000..335eac1c --- /dev/null +++ b/src/PJ_denoy.c @@ -0,0 +1,21 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_denoy.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(denoy, "Denoyer Semi-Elliptical") "\n\tPCyl., no inv., Sph."; +#define C0 0.95 +#define C1 -.08333333333333333333 +#define C3 .00166666666666666666 +#define D1 0.9 +#define D5 0.03 +FORWARD(s_forward); /* spheroid */ + xy.y = lp.phi; + xy.x = lp.lam; + lp.lam = fabs(lp.lam); + xy.x *= cos((C0 + lp.lam * (C1 + lp.lam * lp.lam * C3)) * + (lp.phi * (D1 + D5 * lp.phi * lp.phi * lp.phi * lp.phi))); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(denoy) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_eck1.c b/src/PJ_eck1.c new file mode 100644 index 00000000..18524246 --- /dev/null +++ b/src/PJ_eck1.c @@ -0,0 +1,22 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eck1.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(eck1, "Eckert I") "\n\tPCyl., Sph."; +#define FC .92131773192356127802 +#define RP .31830988618379067154 +FORWARD(s_forward); /* spheroid */ + xy.x = FC * lp.lam * (1. - RP * fabs(lp.phi)); + xy.y = FC * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / FC; + lp.lam = xy.x / (FC * (1. - RP * fabs(lp.phi))); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(eck1) + P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_eck2.c b/src/PJ_eck2.c new file mode 100644 index 00000000..ebfdbda3 --- /dev/null +++ b/src/PJ_eck2.c @@ -0,0 +1,31 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eck2.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(eck2, "Eckert II") "\n\tPCyl. Sph."; +#define FXC 0.46065886596178063902 +#define FYC 1.44720250911653531871 +#define C13 0.33333333333333333333 +#define ONEEPS 1.0000001 +FORWARD(s_forward); /* spheroid */ + xy.x = FXC * lp.lam * (xy.y = sqrt(4. - 3. * sin(fabs(lp.phi)))); + xy.y = FYC * (2. - xy.y); + if ( lp.phi < 0.) xy.y = -xy.y; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.lam = xy.x / (FXC * ( lp.phi = 2. - fabs(xy.y) / FYC) ); + lp.phi = (4. - lp.phi * lp.phi) * C13; + if (fabs(lp.phi) >= 1.) { + if (fabs(lp.phi) > ONEEPS) I_ERROR + else + lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + } else + lp.phi = asin(lp.phi); + if (xy.y < 0) + lp.phi = -lp.phi; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(eck2); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_eck3.c b/src/PJ_eck3.c new file mode 100644 index 00000000..37a56695 --- /dev/null +++ b/src/PJ_eck3.c @@ -0,0 +1,53 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eck3.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double C_x, C_y, A, B; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(eck3, "Eckert III") "\n\tPCyl, Sph."; +PROJ_HEAD(putp1, "Putnins P1") "\n\tPCyl, Sph."; +PROJ_HEAD(wag6, "Wagner VI") "\n\tPCyl, Sph."; +PROJ_HEAD(kav7, "Kavraisky VII") "\n\tPCyl, Sph."; +FORWARD(s_forward); /* spheroid */ + xy.y = P->C_y * lp.phi; + xy.x = P->C_x * lp.lam * (P->A + asqrt(1. - P->B * lp.phi * lp.phi)); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / P->C_y; + lp.lam = xy.x / (P->C_x * (P->A + asqrt(1. - P->B * lp.phi * lp.phi))); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->es = 0.; + P->inv = s_inverse; + P->fwd = s_forward; + return P; +} +ENTRY0(eck3) + P->C_x = .42223820031577120149; + P->C_y = .84447640063154240298; + P->A = 1.; + P->B = 0.4052847345693510857755; +ENDENTRY(setup(P)) +ENTRY0(kav7) + P->C_x = 0.2632401569273184856851; + P->C_x = 0.8660254037844; + P->C_y = 1.; + P->A = 0.; + P->B = 0.30396355092701331433; +ENDENTRY(setup(P)) +ENTRY0(wag6); + P->C_x = P->C_y = 0.94745; + P->A = 0.; + P->B = 0.30396355092701331433; +ENDENTRY(setup(P)) +ENTRY0(putp1); + P->C_x = 1.89490; + P->C_y = 0.94745; + P->A = -0.5; + P->B = 0.30396355092701331433; +ENDENTRY(setup(P)) diff --git a/src/PJ_eck4.c b/src/PJ_eck4.c new file mode 100644 index 00000000..9784a1c4 --- /dev/null +++ b/src/PJ_eck4.c @@ -0,0 +1,47 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eck4.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(eck4, "Eckert IV") "\n\tPCyl, Sph."; +#define C_x .42223820031577120149 +#define C_y 1.32650042817700232218 +#define RC_y .75386330736002178205 +#define C_p 3.57079632679489661922 +#define RC_p .28004957675577868795 +#define EPS 1e-7 +#define NITER 6 +FORWARD(s_forward); /* spheroid */ + double p, V, s, c; + int i; + + p = C_p * sin(lp.phi); + V = lp.phi * lp.phi; + lp.phi *= 0.895168 + V * ( 0.0218849 + V * 0.00826809 ); + for (i = NITER; i ; --i) { + c = cos(lp.phi); + s = sin(lp.phi); + lp.phi -= V = (lp.phi + s * (c + 2.) - p) / + (1. + c * (c + 2.) - s * s); + if (fabs(V) < EPS) + break; + } + if (!i) { + xy.x = C_x * lp.lam; + xy.y = lp.phi < 0. ? -C_y : C_y; + } else { + xy.x = C_x * lp.lam * (1. + cos(lp.phi)); + xy.y = C_y * sin(lp.phi); + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double c; + + lp.phi = aasin(xy.y / C_y); + lp.lam = xy.x / (C_x * (1. + (c = cos(lp.phi)))); + lp.phi = aasin((lp.phi + sin(lp.phi) * (c + 2.)) / C_p); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(eck4); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_eck5.c b/src/PJ_eck5.c new file mode 100644 index 00000000..00b2cae6 --- /dev/null +++ b/src/PJ_eck5.c @@ -0,0 +1,21 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eck5.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(eck5, "Eckert V") "\n\tPCyl, Sph."; +#define XF 0.44101277172455148219 +#define RXF 2.26750802723822639137 +#define YF 0.88202554344910296438 +#define RYF 1.13375401361911319568 +FORWARD(s_forward); /* spheroid */ + xy.x = XF * (1. + cos(lp.phi)) * lp.lam; + xy.y = YF * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.lam = RXF * xy.x / (1. + cos( lp.phi = RYF * xy.y)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(eck5); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_eqc.c b/src/PJ_eqc.c new file mode 100644 index 00000000..d956a47b --- /dev/null +++ b/src/PJ_eqc.c @@ -0,0 +1,26 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eqc.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double rc; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(eqc, "Equidistant Cylindrical (Plate Caree)") + "\n\tCyl, Sph\n\tlat_ts="; +FORWARD(s_forward); /* spheroid */ + xy.x = P->rc * lp.lam; + xy.y = lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y; + lp.lam = xy.x / P->rc; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(eqc) + if ((P->rc = cos(pj_param(P->params, "rlat_ts").f)) <= 0.) E_ERROR(-24); + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_eqdc.c b/src/PJ_eqdc.c new file mode 100644 index 00000000..349266ff --- /dev/null +++ b/src/PJ_eqdc.c @@ -0,0 +1,89 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_eqdc.c 4.2 94/03/16 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double phi1; \ + double phi2; \ + double n; \ + double rho; \ + double rho0; \ + double c; \ + double *en; \ + int ellips; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(eqdc, "Equidistant Conic") + "\n\tConic, Sph&Ell\n\tlat_1= lat_2="; +# define EPS10 1.e-10 +FORWARD(e_forward); /* sphere & ellipsoid */ + P->rho = P->c - (P->ellips ? pj_mlfn(lp.phi, sin(lp.phi), + cos(lp.phi), P->en) : lp.phi); + xy.x = P->rho * sin( lp.lam *= P->n ); + xy.y = P->rho0 - P->rho * cos(lp.lam); + return (xy); +} +INVERSE(e_inverse); /* sphere & ellipsoid */ + if (P->rho = hypot(xy.x, xy.y = P->rho0 - xy.y)) { + if (P->n < 0.) { + P->rho = -P->rho; + xy.x = -xy.x; + xy.y = -xy.y; + } + lp.phi = P->c - P->rho; + if (P->ellips) + lp.phi = pj_inv_mlfn(lp.phi, P->es, P->en); + lp.lam = atan2(xy.x, xy.y) / P->n; + } else { + lp.lam = 0.; + lp.phi = P->n > 0. ? HALFPI : - HALFPI; + } + return (lp); +} +SPECIAL(fac) { + double sinphi, cosphi; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + fac->code |= IS_ANAL_HK; + fac->h = 1.; + fac->k = P->n * (P->c - (P->ellips ? pj_mlfn(lp.phi, sinphi, + cosphi, P->en) : lp.phi)) / pj_msfn(sinphi, cosphi, P->es); +} +FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } +ENTRY1(eqdc, en) + double cosphi, sinphi; + int secant; + + P->phi1 = pj_param(P->params, "rlat_1").f; + P->phi2 = pj_param(P->params, "rlat_2").f; + if (fabs(P->phi1 + P->phi2) < EPS10) E_ERROR(-21); + if (!(P->en = pj_enfn(P->es))) + E_ERROR_0; + P->n = sinphi = sin(P->phi1); + cosphi = cos(P->phi1); + secant = fabs(P->phi1 - P->phi2) >= EPS10; + if (P->ellips = P->es > 0.) { + double ml1, m1; + + m1 = pj_msfn(sinphi, cosphi, P->es); + P->en = pj_enfn(P->es); + ml1 = pj_mlfn(P->phi1, sinphi, cosphi, P->en); + if (secant) { /* secant cone */ + sinphi = sin(P->phi2); + cosphi = cos(P->phi2); + P->n = (m1 - pj_msfn(sinphi, cosphi, P->es)) / + (pj_mlfn(P->phi2, sinphi, cosphi, P->en) - ml1); + } + P->c = ml1 + m1 / P->n; + P->rho0 = P->c - pj_mlfn(P->phi0, sin(P->phi0), + cos(P->phi0), P->en); + } else { + if (secant) + P->n = (cosphi - cos(P->phi2)) / (P->phi2 - P->phi1); + P->c = P->phi1 + cos(P->phi1) / P->n; + P->rho0 = P->c - P->phi0; + } + P->inv = e_inverse; + P->fwd = e_forward; + P->spc = fac; +ENDENTRY(P) diff --git a/src/PJ_fahey.c b/src/PJ_fahey.c new file mode 100644 index 00000000..f49f7401 --- /dev/null +++ b/src/PJ_fahey.c @@ -0,0 +1,20 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_fahey.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(fahey, "Fahey") "\n\tPcyl, Sph."; +#define TOL 1e-6 +FORWARD(s_forward); /* spheroid */ + xy.y = 1.819152 * ( xy.x = tan(0.5 * lp.phi) ); + xy.x = 0.819152 * lp.lam * asqrt(1 - xy.x * xy.x); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = 2. * atan(xy.y /= 1.819152); + lp.lam = fabs(xy.y = 1. - xy.y * xy.y) < TOL ? 0. : + xy.x / (0.819152 * sqrt(xy.y)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(fahey) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_fouc_s.c b/src/PJ_fouc_s.c new file mode 100644 index 00000000..ab6225c6 --- /dev/null +++ b/src/PJ_fouc_s.c @@ -0,0 +1,48 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_fouc_s.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double n, n1; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(fouc_s, "Foucaut Sinusoidal") "\n\tPCyl., Sph."; +#define MAX_ITER 10 +#define LOOP_TOL 1e-7 +FORWARD(s_forward); /* spheroid */ + double t; + + t = cos(lp.phi); + xy.x = lp.lam * t / (P->n + P->n1 * t); + xy.y = P->n * lp.phi + P->n1 * sin(lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double V; + int i; + + if (P->n) { + lp.phi = xy.y; + for (i = MAX_ITER; i ; --i) { + lp.phi -= V = (P->n * lp.phi + P->n1 * sin(lp.phi) - xy.y ) / + (P->n + P->n1 * cos(lp.phi)); + if (fabs(V) < LOOP_TOL) + break; + } + if (!i) + lp.phi = xy.y < 0. ? -HALFPI : HALFPI; + } else + lp.phi = aasin(xy.y); + V = cos(lp.phi); + lp.lam = xy.x * (P->n + P->n1 * V) / V; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(fouc_s) + P->n = pj_param(P->params, "dn").f; + if (P->n < 0. || P->n > 1.) + E_ERROR(-99) + P->n1 = 1. - P->n; + P->es = 0; + P->inv = s_inverse; + P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_gall.c b/src/PJ_gall.c new file mode 100644 index 00000000..537c91af --- /dev/null +++ b/src/PJ_gall.c @@ -0,0 +1,22 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_gall.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(gall, "Gall (Gall Stereographic)") "\n\tCyl, Sph"; +#define YF 1.70710678118654752440 +#define XF 0.70710678118654752440 +#define RYF 0.58578643762690495119 +#define RXF 1.41421356237309504880 +FORWARD(s_forward); /* spheroid */ + xy.x = XF * lp.lam; + xy.y = YF * tan(.5 * lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.lam = RXF * xy.x; + lp.phi = 2. * atan(xy.y * RYF); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(gall) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_gins8.c b/src/PJ_gins8.c new file mode 100644 index 00000000..c288a61d --- /dev/null +++ b/src/PJ_gins8.c @@ -0,0 +1,20 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_gins8.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(gins8, "Ginsburg VIII (TsNIIGAiK)") "\n\tPCyl, Sph., no inv."; +#define Cl 0.000952426 +#define Cp 0.162388 +#define C12 0.08333333333333333 +FORWARD(s_forward); /* spheroid */ + double t = lp.phi * lp.phi; + + xy.y = lp.phi * (1. + t * C12); + xy.x = lp.lam * (1. - Cp * t); + t = lp.lam * lp.lam; + xy.x *= (0.87 - Cl * t * t); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(gins8) P->es = 0.; P->inv = 0; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_gn_sinu.c b/src/PJ_gn_sinu.c new file mode 100644 index 00000000..62cdc872 --- /dev/null +++ b/src/PJ_gn_sinu.c @@ -0,0 +1,104 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_gn_sinu.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double *en; \ + double m, n, C_x, C_y; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(gn_sinu, "General Sinusoidal Series") "\n\tPCyl, Sph.\n\tm= n="; +PROJ_HEAD(sinu, "Sinusoidal (Sanson-Flamsteed)") "\n\tPCyl, Sph&Ell"; +PROJ_HEAD(eck6, "Eckert VI") "\n\tPCyl, Sph."; +PROJ_HEAD(mbtfps, "McBryde-Thomas Flat-Polar Sinusoidal") "\n\tPCyl, Sph."; +#define EPS10 1e-10 +#define MAX_ITER 8 +#define LOOP_TOL 1e-7 +/* Ellipsoidal Sinusoidal only */ +FORWARD(e_forward); /* ellipsoid */ + double s, c; + + xy.y = pj_mlfn(lp.phi, s = sin(lp.phi), c = cos(lp.phi), P->en); + xy.x = lp.lam * c / sqrt(1. - P->es * s * s); + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + double s; + + if ((s = fabs(lp.phi = pj_inv_mlfn(xy.y, P->es, P->en))) < HALFPI) { + s = sin(lp.phi); + lp.lam = xy.x * sqrt(1. - P->es * s * s) / cos(lp.phi); + } else if ((s - EPS10) < HALFPI) + lp.lam = 0.; + else I_ERROR; + return (lp); +} +/* General spherical sinusoidals */ +FORWARD(s_forward); /* sphere */ + if (!P->m) + lp.phi = P->n != 1. ? aasin(P->n * sin(lp.phi)): lp.phi; + else { + double k, V; + int i; + + k = P->n * sin(lp.phi); + for (i = MAX_ITER; i ; --i) { + lp.phi -= V = (P->m * lp.phi + sin(lp.phi) - k) / + (P->m + cos(lp.phi)); + if (fabs(V) < LOOP_TOL) + break; + } + if (!i) + F_ERROR + } + xy.x = P->C_x * lp.lam * (P->m + cos(lp.phi)); + xy.y = P->C_y * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* sphere */ + double s; + + xy.y /= P->C_y; + lp.phi = P->m ? aasin((P->m * xy.y + sin(xy.y)) / P->n) : + ( P->n != 1. ? aasin(sin(xy.y) / P->n) : xy.y ); + lp.lam = xy.x / (P->C_x * (P->m + cos(xy.y))); + return (lp); +} +FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } + static void /* for spheres, only */ +setup(PJ *P) { + P->es = 0; + P->C_x = (P->C_y = sqrt((P->m + 1.) / P->n))/(P->m + 1.); + P->inv = s_inverse; + P->fwd = s_forward; +} +ENTRY1(sinu, en) + if (!(P->en = pj_enfn(P->es))) + E_ERROR_0; + if (P->es) { + P->en = pj_enfn(P->es); + P->inv = e_inverse; + P->fwd = e_forward; + } else { + P->n = 1.; + P->m = 0.; + setup(P); + } +ENDENTRY(P) +ENTRY1(eck6, en) + P->m = 1.; + P->n = 2.570796326794896619231321691; + setup(P); +ENDENTRY(P) +ENTRY1(mbtfps, en) + P->m = 0.5; + P->n = 1.785398163397448309615660845; + setup(P); +ENDENTRY(P) +ENTRY1(gn_sinu, en) + if (pj_param(P->params, "tn").i && pj_param(P->params, "tm").i) { + P->n = pj_param(P->params, "dn").f; + P->m = pj_param(P->params, "dm").f; + } else + E_ERROR(-99) + setup(P); +ENDENTRY(P) diff --git a/src/PJ_gnom.c b/src/PJ_gnom.c new file mode 100644 index 00000000..ecf57739 --- /dev/null +++ b/src/PJ_gnom.c @@ -0,0 +1,108 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_gnom.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double sinph0; \ + double cosph0; \ + int mode; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(gnom, "Gnomonic") "\n\tAzi, Sph."; +#define EPS10 1.e-10 +#define N_POLE 0 +#define S_POLE 1 +#define EQUIT 2 +#define OBLIQ 3 +FORWARD(s_forward); /* spheroid */ + double coslam, cosphi, sinphi; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + switch (P->mode) { + case EQUIT: + xy.y = cosphi * coslam; + break; + case OBLIQ: + xy.y = P->sinph0 * sinphi + P->cosph0 * cosphi * coslam; + break; + case S_POLE: + xy.y = - sinphi; + break; + case N_POLE: + xy.y = sinphi; + break; + } + if (xy.y <= EPS10) F_ERROR; + xy.x = (xy.y = 1. / xy.y) * cosphi * sin(lp.lam); + switch (P->mode) { + case EQUIT: + xy.y *= sinphi; + break; + case OBLIQ: + xy.y *= P->cosph0 * sinphi - P->sinph0 * cosphi * coslam; + break; + case N_POLE: + coslam = - coslam; + case S_POLE: + xy.y *= cosphi * coslam; + break; + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double rh, cosz, sinz; + + rh = hypot(xy.x, xy.y); + sinz = sin(lp.phi = atan(rh)); + cosz = sqrt(1. - sinz * sinz); + if (fabs(rh) <= EPS10) { + lp.phi = P->phi0; + lp.lam = 0.; + } else { + switch (P->mode) { + case OBLIQ: + lp.phi = cosz * P->sinph0 + xy.y * sinz * P->cosph0 / rh; + if (fabs(lp.phi) >= 1.) + lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; + else + lp.phi = asin(lp.phi); + xy.y = (cosz - P->sinph0 * sin(lp.phi)) * rh; + xy.x *= sinz * P->cosph0; + break; + case EQUIT: + lp.phi = xy.y * sinz / rh; + if (fabs(lp.phi) >= 1.) + lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; + else + lp.phi = asin(lp.phi); + xy.y = cosz * rh; + xy.x *= sinz; + break; + case S_POLE: + lp.phi -= HALFPI; + break; + case N_POLE: + lp.phi = HALFPI - lp.phi; + xy.y = -xy.y; + break; + } + lp.lam = atan2(xy.x, xy.y); + } + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(gnom) + if (fabs(fabs(P->phi0) - HALFPI) < EPS10) + P->mode = P->phi0 < 0. ? S_POLE : N_POLE; + else if (fabs(P->phi0) < EPS10) + P->mode = EQUIT; + else { + P->mode = OBLIQ; + P->sinph0 = sin(P->phi0); + P->cosph0 = cos(P->phi0); + } + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_goode.c b/src/PJ_goode.c new file mode 100644 index 00000000..d1e6c447 --- /dev/null +++ b/src/PJ_goode.c @@ -0,0 +1,49 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_goode.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + struct PJconsts *sinu; \ + struct PJconsts *moll; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(goode, "Goode Homolosine") "\n\tPCyl, Sph."; + extern PJ +*pj_sinu(PJ *), *pj_moll(PJ *); +#define Y_COR 0.05280 +#define PHI_LIM .71093078197902358062 +FORWARD(s_forward); /* spheroid */ + if (fabs(lp.phi) <= PHI_LIM) + xy = P->sinu->fwd(lp, P->sinu); + else { + xy = P->moll->fwd(lp, P->moll); + xy.y -= lp.phi >= 0.0 ? Y_COR : -Y_COR; + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + if (fabs(xy.y) <= PHI_LIM) + lp = P->sinu->inv(xy, P->sinu); + else { + xy.y += xy.y >= 0.0 ? Y_COR : -Y_COR; + lp = P->moll->inv(xy, P->moll); + } + return (lp); +} +FREEUP; + if (P) { + if (P->sinu) + (*(P->sinu->pfree))(P->sinu); + if (P->moll) + (*(P->moll->pfree))(P->moll); + pj_dalloc(P); + } +} +ENTRY2(goode, sinu, moll) + P->es = 0.; + if (!(P->sinu = pj_sinu(0)) || !(P->moll = pj_moll(0))) + E_ERROR_0; + if (!(P->sinu = pj_sinu(P->sinu)) || !(P->moll = pj_moll(P->moll))) + E_ERROR_0; + P->fwd = s_forward; + P->inv = s_inverse; +ENDENTRY(P) diff --git a/src/PJ_hammer.c b/src/PJ_hammer.c new file mode 100644 index 00000000..813d6e5f --- /dev/null +++ b/src/PJ_hammer.c @@ -0,0 +1,32 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_hammer.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double w; \ + double m, rm; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff") + "\n\tMisc Sph, no inv.\n\tW= M="; +FORWARD(s_forward); /* spheroid */ + double cosphi, d; + + d = sqrt(2./(1. + (cosphi = cos(lp.phi)) * cos(lp.lam *= P->w))); + xy.x = P->m * d * cosphi * sin(lp.lam); + xy.y = P->rm * d * sin(lp.phi); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(hammer) + if (pj_param(P->params, "tW").i) { + if ((P->w = fabs(pj_param(P->params, "dW").f)) <= 0.) E_ERROR(-27); + } else + P->w = .5; + if (pj_param(P->params, "tM").i) { + if ((P->m = fabs(pj_param(P->params, "dM").f)) <= 0.) E_ERROR(-27); + } else + P->m = 1.; + P->rm = 1. / P->m; + P->m /= P->w; + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_hatano.c b/src/PJ_hatano.c new file mode 100644 index 00000000..8b661b3c --- /dev/null +++ b/src/PJ_hatano.c @@ -0,0 +1,53 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_hatano.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") "\n\tPCyl, Sph."; +#define NITER 20 +#define EPS 1e-7 +#define ONETOL 1.000001 +#define CN 2.67595 +#define CS 2.43763 +#define RCN 0.37369906014686373063 +#define RCS 0.41023453108141924738 +#define FYCN 1.75859 +#define FYCS 1.93052 +#define RYCN 0.56863737426006061674 +#define RYCS 0.51799515156538134803 +#define FXC 0.85 +#define RXC 1.17647058823529411764 +FORWARD(s_forward); /* spheroid */ + double th1, c; + int i; + + c = sin(lp.phi) * (lp.phi < 0. ? CS : CN); + for (i = NITER; i; --i) { + lp.phi -= th1 = (lp.phi + sin(lp.phi) - c) / (1. + cos(lp.phi)); + if (fabs(th1) < EPS) break; + } + xy.x = FXC * lp.lam * cos(lp.phi *= .5); + xy.y = sin(lp.phi) * (lp.phi < 0. ? FYCS : FYCN); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double th; + + th = xy.y * ( xy.y < 0. ? RYCS : RYCN); + if (fabs(th) > 1.) + if (fabs(th) > ONETOL) I_ERROR + else th = th > 0. ? HALFPI : - HALFPI; + else + th = asin(th); + lp.lam = RXC * xy.x / cos(th); + th += th; + lp.phi = (th + sin(th)) * (xy.y < 0. ? RCS : RCN); + if (fabs(lp.phi) > 1.) + if (fabs(lp.phi) > ONETOL) I_ERROR + else lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; + else + lp.phi = asin(lp.phi); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(hatano) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_imw_p.c b/src/PJ_imw_p.c new file mode 100644 index 00000000..58d04f8c --- /dev/null +++ b/src/PJ_imw_p.c @@ -0,0 +1,154 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_imw_p.c 4.1 94/05/22 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double P, Pp, Q, Qp, R_1, R_2, sphi_1, sphi_2, C2; \ + double phi_1, phi_2, lam_1; \ + double *en; \ + int mode; /* = 0, phi_1 and phi_2 != 0, = 1, phi_1 = 0, = -1 phi_2 = 0 */ +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(imw_p, "International Map of the World Polyconic") + "\n\tMod. Polyconic, Ell\n\tlat_1= and lat_2= [lon_1=]"; +#define TOL 1e-10 +#define EPS 1e-10 + static int +phi12(PJ *P, double *del, double *sig) { + int err = 0; + + if (!pj_param(P->params, "tlat_1").i || + !pj_param(P->params, "tlat_2").i) { + err = -41; + } else { + P->phi_1 = pj_param(P->params, "rlat_1").f; + P->phi_2 = pj_param(P->params, "rlat_2").f; + *del = 0.5 * (P->phi_2 - P->phi_1); + *sig = 0.5 * (P->phi_2 + P->phi_1); + err = (fabs(*del) < EPS || fabs(*sig) < EPS) ? -42 : 0; + } + return err; +} + static XY +loc_for(LP lp, PJ *P, double *yc) { + XY xy; + + if (! lp.phi) { + xy.x = lp.lam; + xy.y = 0.; + } else { + double xa, ya, xb, yb, xc, yc, D, B, m, sp, t, R, C; + + sp = sin(lp.phi); + m = pj_mlfn(lp.phi, sp, cos(lp.phi), P->en); + xa = P->Pp + P->Qp * m; + ya = P->P + P->Q * m; + R = 1. / (tan(lp.phi) * sqrt(1. - P->es * sp * sp)); + C = sqrt(R * R - xa * xa); + if (lp.phi < 0.) C = - C; + C += ya - R; + if (P->mode < 0) { + xb = lp.lam; + yb = P->C2; + } else { + t = lp.lam * P->sphi_2; + xb = P->R_2 * sin(t); + yb = P->C2 + P->R_2 * (1. - cos(t)); + } + if (P->mode > 0) { + xc = lp.lam; + yc = 0.; + } else { + t = lp.lam * P->sphi_1; + xc = P->R_1 * sin(t); + yc = P->R_1 * (1. - cos(t)); + } + D = (xb - xc)/(yb - yc); + B = xc + D * (C + R - yc); + xy.x = D * sqrt(R * R * (1 + D * D) - B * B); + if (lp.phi > 0) + xy.x = - xy.x; + xy.x = (B + xy.x) / (1. + D * D); + xy.y = sqrt(R * R - xy.x * xy.x); + if (lp.phi > 0) + xy.y = - xy.y; + xy.y += C + R; + } + return (xy); +} +FORWARD(e_forward); /* ellipsoid */ + double yc; + xy = loc_for(lp, P, &yc); + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + XY t; + double yc; + + lp.phi = P->phi_2; + lp.lam = xy.x / cos(lp.phi); + do { + t = loc_for(lp, P, &yc); + lp.phi = ((lp.phi - P->phi_1) * (xy.y - yc) / (t.y - yc)) + P->phi_1; + lp.lam = lp.lam * xy.x / t.x; + } while (fabs(t.x - xy.x) > TOL || fabs(t.y - xy.y) > TOL); + return (lp); +} + static void +xy(PJ *P, double phi, double *x, double *y, double *sp, double *R) { + double t, F; + + *sp = sin(phi); + *R = 1./(tan(phi) * sqrt(1. - P->es * *sp * *sp )); + F = P->lam_1 * *sp; + *y = *R * (1 - cos(F)); + *x = *R * sin(F); +} +FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } +ENTRY1(imw_p, en) + double del, sig, s, t, x1, x2, T2, y1, m1, m2, y2; + int i; + + if (!(P->en = pj_enfn(P->es))) E_ERROR_0; + if (i = phi12(P, &del, &sig)) + E_ERROR(i); + if (P->phi_2 < P->phi_1) { /* make sure P->phi_1 most southerly */ + del = P->phi_1; + P->phi_1 = P->phi_2; + P->phi_2 = del; + } + if (pj_param(P->params, "tlon_1").i) + P->lam_1 = pj_param(P->params, "rlon_1").f; + else { /* use predefined based upon latitude */ + sig = fabs(sig * RAD_TO_DEG); + if (sig <= 60) sig = 2.; + else if (sig <= 76) sig = 4.; + else sig = 8.; + P->lam_1 = sig * DEG_TO_RAD; + } + P->mode = 0; + if (P->phi_1) xy(P, P->phi_1, &x1, &y1, &P->sphi_1, &P->R_1); + else { + P->mode = 1; + y1 = 0.; + x1 = P->lam_1; + } + if (P->phi_2) xy(P, P->phi_2, &x2, &T2, &P->sphi_2, &P->R_2); + else { + P->mode = -1; + T2 = 0.; + x2 = P->lam_1; + } + m1 = pj_mlfn(P->phi_1, P->sphi_1, cos(P->phi_1), P->en); + m2 = pj_mlfn(P->phi_2, P->sphi_2, cos(P->phi_2), P->en); + t = m2 - m1; + s = x2 - x1; + y2 = sqrt(t * t - s * s) + y1; + P->C2 = y2 - T2; + t = 1. / t; + P->P = (m2 * y1 - m1 * y2) * t; + P->Q = (y2 - y1) * t; + P->Pp = (m2 * x1 - m1 * x2) * t; + P->Qp = (x2 - x1) * t; + P->fwd = e_forward; + P->inv = e_inverse; +ENDENTRY(P) diff --git a/src/PJ_labrd.c b/src/PJ_labrd.c new file mode 100644 index 00000000..01b0406f --- /dev/null +++ b/src/PJ_labrd.c @@ -0,0 +1,112 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_labrd.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double Az, kRg, p0s, A, C, Ca, Cb, Cc, Cd; \ + int rot; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(labrd, "Laborde") "\n\tCyl, Sph\n\tSpecial for Madagascar"; +#define EPS 1.e-10 +FORWARD(e_forward); + double V1, V2, ps, sinps, cosps, sinps2, cosps2, I1, I2, I3, I4, I5, I6, + x2, y2, t; + + V1 = P->A * log( tan(FORTPI + .5 * lp.phi) ); + t = P->e * sin(lp.phi); + V2 = .5 * P->e * P->A * log ((1. + t)/(1. - t)); + ps = 2. * (atan(exp(V1 - V2 + P->C)) - FORTPI); + I1 = ps - P->p0s; + cosps = cos(ps); cosps2 = cosps * cosps; + sinps = sin(ps); sinps2 = sinps * sinps; + I4 = P->A * cosps; + I2 = .5 * P->A * I4 * sinps; + I3 = I2 * P->A * P->A * (5. * cosps2 - sinps2) / 12.; + I6 = I4 * P->A * P->A; + I5 = I6 * (cosps2 - sinps2) / 6.; + I6 *= P->A * P->A * + (5. * cosps2 * cosps2 + sinps2 * (sinps2 - 18. * cosps2)) / 120.; + t = lp.lam * lp.lam; + xy.x = P->kRg * lp.lam * (I4 + t * (I5 + t * I6)); + xy.y = P->kRg * (I1 + t * (I2 + t * I3)); + x2 = xy.x * xy.x; + y2 = xy.y * xy.y; + V1 = 3. * xy.x * y2 - xy.x * x2; + V2 = xy.y * y2 - 3. * x2 * xy.y; + xy.x += P->Ca * V1 + P->Cb * V2; + xy.y += P->Ca * V2 - P->Cb * V1; + return (xy); +} +INVERSE(e_inverse); /* ellipsoid & spheroid */ + double x2, y2, V1, V2, V3, V4, t, t2, ps, pe, tpe, s, + I7, I8, I9, I10, I11, d, Re; + int i; + + x2 = xy.x * xy.x; + y2 = xy.y * xy.y; + V1 = 3. * xy.x * y2 - xy.x * x2; + V2 = xy.y * y2 - 3. * x2 * xy.y; + V3 = xy.x * (5. * y2 * y2 + x2 * (-10. * y2 + x2 )); + V4 = xy.y * (5. * x2 * x2 + y2 * (-10. * x2 + y2 )); + xy.x += - P->Ca * V1 - P->Cb * V2 + P->Cc * V3 + P->Cd * V4; + xy.y += P->Cb * V1 - P->Ca * V2 - P->Cd * V3 + P->Cc * V4; + ps = P->p0s + xy.y / P->kRg; + pe = ps + P->phi0 - P->p0s; + for ( i = 20; i; --i) { + V1 = P->A * log(tan(FORTPI + .5 * pe)); + tpe = P->e * sin(pe); + V2 = .5 * P->e * P->A * log((1. + tpe)/(1. - tpe)); + t = ps - 2. * (atan(exp(V1 - V2 + P->C)) - FORTPI); + pe += t; + if (fabs(t) < EPS) + break; + } +/* + if (!i) { + } else { + } +*/ + t = P->e * sin(pe); + t = 1. - t * t; + Re = P->one_es / ( t * sqrt(t) ); + t = tan(ps); + t2 = t * t; + s = P->kRg * P->kRg; + d = Re * P->k0 * P->kRg; + I7 = t / (2. * d); + I8 = t * (5. + 3. * t2) / (24. * d * s); + d = cos(ps) * P->kRg * P->A; + I9 = 1. / d; + d *= s; + I10 = (1. + 2. * t2) / (6. * d); + I11 = (5. + t2 * (28. + 24. * t2)) / (120. * d * s); + x2 = xy.x * xy.x; + lp.phi = pe + x2 * (-I7 + I8 * x2); + lp.lam = xy.x * (I9 + x2 * (-I10 + x2 * I11)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(labrd) + double Az, sinp, R, N, t; + + P->rot = pj_param(P->params, "bno_rot").i == 0; + Az = pj_param(P->params, "razi").f; + sinp = sin(P->phi0); + t = 1. - P->es * sinp * sinp; + N = 1. / sqrt(t); + R = P->one_es * N / t; + P->kRg = P->k0 * sqrt( N * R ); + P->p0s = atan( sqrt(R / N) * tan(P->phi0) ); + P->A = sinp / sin(P->p0s); + t = P->e * sinp; + P->C = .5 * P->e * P->A * log((1. + t)/(1. - t)) + + - P->A * log( tan(FORTPI + .5 * P->phi0)) + + log( tan(FORTPI + .5 * P->p0s)); + t = Az + Az; + P->Ca = (1. - cos(t)) * ( P->Cb = 1. / (12. * P->kRg * P->kRg) ); + P->Cb *= sin(t); + P->Cc = 3. * (P->Ca * P->Ca - P->Cb * P->Cb); + P->Cd = 6. * P->Ca * P->Cb; + P->inv = e_inverse; + P->fwd = e_forward; +ENDENTRY(P) diff --git a/src/PJ_laea.c b/src/PJ_laea.c new file mode 100644 index 00000000..dab96700 --- /dev/null +++ b/src/PJ_laea.c @@ -0,0 +1,230 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_laea.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double sinb1; \ + double cosb1; \ + double xmf; \ + double ymf; \ + double mmf; \ + double qp; \ + double dd; \ + double rq; \ + double *apa; \ + int mode; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(laea, "Lambert Azimuthal Equal Area") "\n\tAzi, Sph&Ell"; +#define sinph0 P->sinb1 +#define cosph0 P->cosb1 +#define EPS10 1.e-10 +#define NITER 20 +#define CONV 1.e-10 +#define N_POLE 0 +#define S_POLE 1 +#define EQUIT 2 +#define OBLIQ 3 +FORWARD(e_forward); /* ellipsoid */ + double coslam, sinlam, sinphi, q, sinb, cosb, b; + + coslam = cos(lp.lam); + sinlam = sin(lp.lam); + sinphi = sin(lp.phi); + q = pj_qsfn(sinphi, P->e, P->one_es); + if (P->mode == OBLIQ || P->mode == EQUIT) { + sinb = q / P->qp; + cosb = sqrt(1. - sinb * sinb); + } + switch (P->mode) { + case OBLIQ: + b = 1. + P->sinb1 * sinb + P->cosb1 * cosb * coslam; + break; + case EQUIT: + b = 1. + cosb * coslam; + break; + case N_POLE: + b = HALFPI + lp.phi; + q = P->qp - q; + break; + case S_POLE: + b = lp.phi - HALFPI; + q = P->qp + q; + break; + } + if (fabs(b) < EPS10) F_ERROR; + switch (P->mode) { + case OBLIQ: + xy.y = P->ymf * ( b = sqrt(2. / b) ) + * (P->cosb1 * sinb - P->sinb1 * cosb * coslam); + goto eqcon; + break; + case EQUIT: + xy.y = (b = sqrt(2. / (1. + cosb * coslam))) * sinb * P->ymf; +eqcon: + xy.x = P->xmf * b * cosb * sinlam; + break; + case N_POLE: + case S_POLE: + if (q >= 0.) { + xy.x = (b = sqrt(q)) * sinlam; + xy.y = coslam * (P->mode == S_POLE ? b : -b); + } else + xy.x = xy.y = 0.; + break; + } + return (xy); +} +FORWARD(s_forward); /* spheroid */ + double coslam, cosphi, sinphi; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + switch (P->mode) { + case EQUIT: + xy.y = 1. + cosphi * coslam; + goto oblcon; + case OBLIQ: + xy.y = 1. + sinph0 * sinphi + cosph0 * cosphi * coslam; +oblcon: + if (xy.y <= EPS10) F_ERROR; + xy.x = (xy.y = sqrt(2. / xy.y)) * cosphi * sin(lp.lam); + xy.y *= P->mode == EQUIT ? sinphi : + cosph0 * sinphi - sinph0 * cosphi * coslam; + break; + case N_POLE: + coslam = -coslam; + case S_POLE: + if (fabs(lp.phi + P->phi0) < EPS10) F_ERROR; + xy.y = FORTPI - lp.phi * .5; + xy.y = 2. * (P->mode == S_POLE ? cos(xy.y) : sin(xy.y)); + xy.x = xy.y * sin(lp.lam); + xy.y *= coslam; + break; + } + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + double cCe, sCe, q, rho, ab; + + switch (P->mode) { + case EQUIT: + case OBLIQ: + if ((rho = hypot(xy.x /= P->dd, xy.y *= P->dd)) < EPS10) { + lp.lam = 0.; + lp.phi = P->phi0; + return (lp); + } + cCe = cos(sCe = 2. * asin(.5 * rho / P->rq)); + xy.x *= (sCe = sin(sCe)); + if (P->mode == OBLIQ) { + q = P->qp * (ab = cCe * P->sinb1 + xy.y * sCe * P->cosb1 / rho); + xy.y = rho * P->cosb1 * cCe - xy.y * P->sinb1 * sCe; + } else { + q = P->qp * (ab = xy.y * sCe / rho); + xy.y = rho * cCe; + } + break; + case N_POLE: + xy.y = -xy.y; + case S_POLE: + if (!(q = (xy.x * xy.x + xy.y * xy.y)) ) { + lp.lam = 0.; + lp.phi = P->phi0; + return (lp); + } + /* + q = P->qp - q; + */ + ab = 1. - q / P->qp; + if (P->mode == S_POLE) + ab = - ab; + break; + } + lp.lam = atan2(xy.x, xy.y); + lp.phi = pj_authlat(asin(ab), P->apa); + return (lp); +} +INVERSE(s_inverse); /* spheroid */ + double cosz, rh, sinz; + + rh = hypot(xy.x, xy.y); + if ((lp.phi = rh * .5 ) > 1.) I_ERROR; + lp.phi = 2. * asin(lp.phi); + if (P->mode == OBLIQ || P->mode == EQUIT) { + sinz = sin(lp.phi); + cosz = cos(lp.phi); + } + switch (P->mode) { + case EQUIT: + lp.phi = fabs(rh) <= EPS10 ? 0. : asin(xy.y * sinz / rh); + xy.x *= sinz; + xy.y = cosz * rh; + break; + case OBLIQ: + lp.phi = fabs(rh) <= EPS10 ? P->phi0 : + asin(cosz * sinph0 + xy.y * sinz * cosph0 / rh); + xy.x *= sinz * cosph0; + xy.y = (cosz - sin(lp.phi) * sinph0) * rh; + break; + case N_POLE: + xy.y = -xy.y; + lp.phi = HALFPI - lp.phi; + break; + case S_POLE: + lp.phi -= HALFPI; + break; + } + lp.lam = (xy.y == 0. && (P->mode == EQUIT || P->mode == OBLIQ)) ? + 0. : atan2(xy.x, xy.y); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(laea) + double t; + + if (fabs((t = fabs(P->phi0)) - HALFPI) < EPS10) + P->mode = P->phi0 < 0. ? S_POLE : N_POLE; + else if (fabs(t) < EPS10) + P->mode = EQUIT; + else + P->mode = OBLIQ; + if (P->es) { + double sinphi; + + P->e = sqrt(P->es); + P->qp = pj_qsfn(1., P->e, P->one_es); + P->mmf = .5 / (1. - P->es); + P->apa = pj_authset(P->es); + switch (P->mode) { + case N_POLE: + case S_POLE: + P->dd = 1.; + break; + case EQUIT: + P->dd = 1. / (P->rq = sqrt(.5 * P->qp)); + P->xmf = 1.; + P->ymf = .5 * P->qp; + break; + case OBLIQ: + P->rq = sqrt(.5 * P->qp); + sinphi = sin(P->phi0); + P->sinb1 = pj_qsfn(sinphi, P->e, P->one_es) / P->qp; + P->cosb1 = sqrt(1. - P->sinb1 * P->sinb1); + P->dd = cos(P->phi0) / (sqrt(1. - P->es * sinphi * sinphi) * + P->rq * P->cosb1); + P->ymf = (P->xmf = P->rq) / P->dd; + P->xmf *= P->dd; + break; + } + P->inv = e_inverse; + P->fwd = e_forward; + } else { + if (P->mode == OBLIQ) { + sinph0 = sin(P->phi0); + cosph0 = cos(P->phi0); + } + P->inv = s_inverse; + P->fwd = s_forward; + } +ENDENTRY(P) diff --git a/src/PJ_lagrng.c b/src/PJ_lagrng.c new file mode 100644 index 00000000..a9de99c2 --- /dev/null +++ b/src/PJ_lagrng.c @@ -0,0 +1,38 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_lagrng.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double hrw; \ + double rw; \ + double a1; +#define TOL 1e-10 +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(lagrng, "Lagrange") "\n\tMisc Sph, no inv.\n\tW="; +FORWARD(s_forward); /* spheroid */ + double v, c; + + if (fabs(fabs(lp.phi) - HALFPI) < TOL) { + xy.x = 0; + xy.y = lp.phi < 0 ? -2. : 2.; + } else { + lp.phi = sin(lp.phi); + v = P->a1 * pow((1. + lp.phi)/(1. - lp.phi), P->hrw); + if ((c = 0.5 * (v + 1./v) + cos(lp.lam *= P->rw)) < TOL) + F_ERROR; + xy.x = 2. * sin(lp.lam) / c; + xy.y = (v - 1./v) / c; + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(lagrng) + double phi1; + + if ((P->rw = pj_param(P->params, "dW").f) <= 0) E_ERROR(-27); + P->hrw = 0.5 * (P->rw = 1. / P->rw); + phi1 = pj_param(P->params, "rlat_1").f; + if (fabs(fabs(phi1 = sin(phi1)) - 1.) < TOL) E_ERROR(-22); + P->a1 = pow((1. - phi1)/(1. + phi1), P->hrw); + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_larr.c b/src/PJ_larr.c new file mode 100644 index 00000000..f44eab9f --- /dev/null +++ b/src/PJ_larr.c @@ -0,0 +1,15 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_larr.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(larr, "Larrivee") "\n\tMisc Sph, no inv."; +#define SIXTH .16666666666666666 +FORWARD(s_forward); /* sphere */ + xy.x = 0.5 * lp.lam * (1. + sqrt(cos(lp.phi))); + xy.y = lp.phi / (cos(0.5 * lp.phi) * cos(SIXTH * lp.lam)); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(larr) P->fwd = s_forward; P->inv = 0; P->es = 0.; ENDENTRY(P) diff --git a/src/PJ_lask.c b/src/PJ_lask.c new file mode 100644 index 00000000..34a61d94 --- /dev/null +++ b/src/PJ_lask.c @@ -0,0 +1,29 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_lask.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(lask, "Laskowski") "\n\tMisc Sph, no inv."; +#define a10 0.975534 +#define a12 -0.119161 +#define a32 -0.0143059 +#define a14 -0.0547009 +#define b01 1.00384 +#define b21 0.0802894 +#define b03 0.0998909 +#define b41 0.000199025 +#define b23 -0.0285500 +#define b05 -0.0491032 +FORWARD(s_forward); /* sphere */ + double l2, p2; + + l2 = lp.lam * lp.lam; + p2 = lp.phi * lp.phi; + xy.x = lp.lam * (a10 + p2 * (a12 + l2 * a32 + p2 * a14)); + xy.y = lp.phi * (b01 + l2 * (b21 + p2 * b23 + l2 * b41) + + p2 * (b03 + p2 * b05)); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(lask) P->fwd = s_forward; P->inv = 0; P->es = 0.; ENDENTRY(P) diff --git a/src/PJ_lcc.c b/src/PJ_lcc.c new file mode 100644 index 00000000..9e697cd9 --- /dev/null +++ b/src/PJ_lcc.c @@ -0,0 +1,106 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_lcc.c 4.2 94/03/18 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double phi1; \ + double phi2; \ + double n; \ + double rho; \ + double rho0; \ + double c; \ + int ellips; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(lcc, "Lambert Conformal Conic") + "\n\tConic, Sph&Ell\n\tlat_1= and lat_2= or lat_0"; +# define EPS10 1.e-10 +FORWARD(e_forward); /* ellipsoid & spheroid */ + if (fabs(fabs(lp.phi) - HALFPI) < EPS10) { + if ((lp.phi * P->n) <= 0.) F_ERROR; + P->rho = 0.; + } + else + P->rho = P->c * (P->ellips ? pow(pj_tsfn(lp.phi, sin(lp.phi), + P->e), P->n) : pow(tan(FORTPI + .5 * lp.phi), -P->n)); + xy.x = P->k0 * (P->rho * sin( lp.lam *= P->n ) ); + xy.y = P->k0 * (P->rho0 - P->rho * cos(lp.lam) ); + return (xy); +} +INVERSE(e_inverse); /* ellipsoid & spheroid */ + xy.x /= P->k0; + xy.y /= P->k0; + if (P->rho = hypot(xy.x, xy.y = P->rho0 - xy.y)) { + if (P->n < 0.) { + P->rho = -P->rho; + xy.x = -xy.x; + xy.y = -xy.y; + } + if (P->ellips) { + if ((lp.phi = pj_phi2(pow(P->rho / P->c, 1./P->n), P->e)) + == HUGE_VAL) + I_ERROR; + } else + lp.phi = 2. * atan(pow(P->c / P->rho, 1./P->n)) - HALFPI; + lp.lam = atan2(xy.x, xy.y) / P->n; + } else { + lp.lam = 0.; + lp.phi = P->n > 0. ? HALFPI : - HALFPI; + } + return (lp); +} +SPECIAL(fac) { + if (fabs(fabs(lp.phi) - HALFPI) < EPS10) { + if ((lp.phi * P->n) <= 0.) return; + P->rho = 0.; + } else + P->rho = P->c * (P->ellips ? pow(pj_tsfn(lp.phi, sin(lp.phi), + P->e), P->n) : pow(tan(FORTPI + .5 * lp.phi), -P->n)); + fac->code |= IS_ANAL_HK + IS_ANAL_CONV; + fac->k = fac->h = P->k0 * P->n * P->rho / + pj_msfn(sin(lp.phi), cos(lp.phi), P->es); + fac->conv = - P->n * lp.lam; +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(lcc) + double cosphi, sinphi; + int secant; + + P->phi1 = pj_param(P->params, "rlat_1").f; + if (pj_param(P->params, "tlat_2").i) + P->phi2 = pj_param(P->params, "rlat_2").f; + else { + P->phi2 = P->phi1; + if (!pj_param(P->params, "tlat_0").i) + P->phi0 = P->phi1; + } + if (fabs(P->phi1 + P->phi2) < EPS10) E_ERROR(-21); + P->n = sinphi = sin(P->phi1); + cosphi = cos(P->phi1); + secant = fabs(P->phi1 - P->phi2) >= EPS10; + if (P->ellips = (P->es != 0.)) { + double ml1, m1; + + P->e = sqrt(P->es); + m1 = pj_msfn(sinphi, cosphi, P->es); + ml1 = pj_tsfn(P->phi1, sinphi, P->e); + if (secant) { /* secant cone */ + P->n = log(m1 / + pj_msfn(sinphi = sin(P->phi2), cos(P->phi2), P->es)); + P->n /= log(ml1 / pj_tsfn(P->phi2, sinphi, P->e)); + } + P->c = (P->rho0 = m1 * pow(ml1, -P->n) / P->n); + P->rho0 *= (fabs(fabs(P->phi0) - HALFPI) < EPS10) ? 0. : + pow(pj_tsfn(P->phi0, sin(P->phi0), P->e), P->n); + } else { + if (secant) + P->n = log(cosphi / cos(P->phi2)) / + log(tan(FORTPI + .5 * P->phi2) / + tan(FORTPI + .5 * P->phi1)); + P->c = cosphi * pow(tan(FORTPI + .5 * P->phi1), P->n) / P->n; + P->rho0 = (fabs(fabs(P->phi0) - HALFPI) < EPS10) ? 0. : + P->c * pow(tan(FORTPI + .5 * P->phi0), -P->n); + } + P->inv = e_inverse; + P->fwd = e_forward; + P->spc = fac; +ENDENTRY(P) diff --git a/src/PJ_loxim.c b/src/PJ_loxim.c new file mode 100644 index 00000000..4828d973 --- /dev/null +++ b/src/PJ_loxim.c @@ -0,0 +1,44 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_loxim.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double phi1; \ + double cosphi1; \ + double tanphi1; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(loxim, "Loximuthal") "\n\tPCyl Sph"; +#define EPS 1e-8 +FORWARD(s_forward); /* spheroid */ + xy.y = lp.phi - P->phi1; + if (fabs(xy.y) < EPS) + xy.x = lp.lam * P->cosphi1; + else { + xy.x = FORTPI + 0.5 * lp.phi; + if (fabs(xy.x) < EPS || fabs(fabs(xy.x) - HALFPI) < EPS) + xy.x = 0.; + else + xy.x = lp.lam * xy.y / log( tan(xy.x) / P->tanphi1 ); + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y + P->phi1; + if (fabs(xy.y) < EPS) + lp.lam = xy.x / P->cosphi1; + else + if (fabs( lp.lam = FORTPI + 0.5 * lp.phi ) < EPS || + fabs(fabs(lp.lam) - HALFPI) < EPS) + lp.lam = 0.; + else + lp.lam = xy.x * log( tan(lp.lam) / P->tanphi1 ) / xy.y ; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(loxim); + P->phi1 = pj_param(P->params, "rlat_1").f; + if ((P->cosphi1 = cos(P->phi1)) < EPS) E_ERROR(-22); + P->tanphi1 = tan(FORTPI + 0.5 * P->phi1); + P->inv = s_inverse; P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_lsat.c b/src/PJ_lsat.c new file mode 100644 index 00000000..ddde1224 --- /dev/null +++ b/src/PJ_lsat.c @@ -0,0 +1,174 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_lsat.c 4.1 94/02/15 GIE REL"; +#endif +/* based upon Snyder and Linck, USGS-NMD */ +#define PROJ_PARMS__ \ + double a2, a4, b, c1, c3; \ + double q, t, u, w, p22, sa, ca, xj, rlm, rlm2; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(lsat, "Space oblique for LANDSAT") + "\n\tCyl, Sph&Ell\n\tlsat= path="; +#define TOL 1e-7 +#define PI_HALFPI 4.71238898038468985766 +#define TWOPI_HALFPI 7.85398163397448309610 + static void +seraz0(double lam, double mult, PJ *P) { + double sdsq, h, s, fc, sd, sq, d__1; + + lam *= DEG_TO_RAD; + sd = sin(lam); + sdsq = sd * sd; + s = P->p22 * P->sa * cos(lam) * sqrt((1. + P->t * sdsq) / (( + 1. + P->w * sdsq) * (1. + P->q * sdsq))); + d__1 = 1. + P->q * sdsq; + h = sqrt((1. + P->q * sdsq) / (1. + P->w * sdsq)) * ((1. + + P->w * sdsq) / (d__1 * d__1) - P->p22 * P->ca); + sq = sqrt(P->xj * P->xj + s * s); + P->b += fc = mult * (h * P->xj - s * s) / sq; + P->a2 += fc * cos(lam + lam); + P->a4 += fc * cos(lam * 4.); + fc = mult * s * (h + P->xj) / sq; + P->c1 += fc * cos(lam); + P->c3 += fc * cos(lam * 3.); +} +FORWARD(e_forward); /* ellipsoid */ + int l, nn; + double lamt, xlam, sdsq, c, d, s, lamdp, phidp, lampp, tanph, + lamtp, cl, sd, sp, fac, sav, tanphi; + + if (lp.phi > HALFPI) + lp.phi = HALFPI; + else if (lp.phi < -HALFPI) + lp.phi = -HALFPI; + lampp = lp.phi >= 0. ? HALFPI : PI_HALFPI; + tanphi = tan(lp.phi); + for (nn = 0;;) { + sav = lampp; + lamtp = lp.lam + P->p22 * lampp; + cl = cos(lamtp); + if (fabs(cl) < TOL) + lamtp -= TOL; + fac = lampp - sin(lampp) * (cl < 0. ? -HALFPI : HALFPI); + for (l = 50; l; --l) { + lamt = lp.lam + P->p22 * sav; + if (fabs(c = cos(lamt)) < TOL) + lamt -= TOL; + xlam = (P->one_es * tanphi * P->sa + sin(lamt) * P->ca) / c; + lamdp = atan(xlam) + fac; + if (fabs(fabs(sav) - fabs(lamdp)) < TOL) + break; + sav = lamdp; + } + if (!l || ++nn >= 3 || (lamdp > P->rlm && lamdp < P->rlm2)) + break; + if (lamdp <= P->rlm) + lampp = TWOPI_HALFPI; + else if (lamdp >= P->rlm2) + lampp = HALFPI; + } + if (l) { + sp = sin(lp.phi); + phidp = aasin((P->one_es * P->ca * sp - P->sa * cos(lp.phi) * + sin(lamt)) / sqrt(1. - P->es * sp * sp)); + tanph = log(tan(FORTPI + .5 * phidp)); + sd = sin(lamdp); + sdsq = sd * sd; + s = P->p22 * P->sa * cos(lamdp) * sqrt((1. + P->t * sdsq) + / ((1. + P->w * sdsq) * (1. + P->q * sdsq))); + d = sqrt(P->xj * P->xj + s * s); + xy.x = P->b * lamdp + P->a2 * sin(2. * lamdp) + P->a4 * + sin(lamdp * 4.) - tanph * s / d; + xy.y = P->c1 * sd + P->c3 * sin(lamdp * 3.) + tanph * P->xj / d; + } else + xy.x = xy.y = HUGE_VAL; + return xy; +} +INVERSE(e_inverse); /* ellipsoid */ + int nn; + double lamt, sdsq, s, lamdp, phidp, sppsq, dd, sd, sl, fac, scl, sav, spp; + + lamdp = xy.x / P->b; + nn = 50; + do { + sav = lamdp; + sd = sin(lamdp); + sdsq = sd * sd; + s = P->p22 * P->sa * cos(lamdp) * sqrt((1. + P->t * sdsq) + / ((1. + P->w * sdsq) * (1. + P->q * sdsq))); + lamdp = xy.x + xy.y * s / P->xj - P->a2 * sin( + 2. * lamdp) - P->a4 * sin(lamdp * 4.) - s / P->xj * ( + P->c1 * sin(lamdp) + P->c3 * sin(lamdp * 3.)); + lamdp /= P->b; + } while (fabs(lamdp - sav) >= TOL && --nn); + sl = sin(lamdp); + fac = exp(sqrt(1. + s * s / P->xj / P->xj) * (xy.y - + P->c1 * sl - P->c3 * sin(lamdp * 3.))); + phidp = 2. * (atan(fac) - FORTPI); + dd = sl * sl; + if (fabs(cos(lamdp)) < TOL) + lamdp -= TOL; + spp = sin(phidp); + sppsq = spp * spp; + lamt = atan(((1. - sppsq * P->rone_es) * tan(lamdp) * + P->ca - spp * P->sa * sqrt((1. + P->q * dd) * ( + 1. - sppsq) - sppsq * P->u) / cos(lamdp)) / (1. - sppsq + * (1. + P->u))); + sl = lamt >= 0. ? 1. : -1.; + scl = cos(lamdp) >= 0. ? 1. : -1; + lamt -= HALFPI * (1. - scl) * sl; + lp.lam = lamt - P->p22 * lamdp; + if (fabs(P->sa) < TOL) + lp.phi = aasin(spp / sqrt(P->one_es * P->one_es + P->es * sppsq)); + else + lp.phi = atan((tan(lamdp) * cos(lamt) - P->ca * sin(lamt)) / + (P->one_es * P->sa)); + return lp; +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(lsat) + int land, path; + double lam, alf, esc, ess; + + land = pj_param(P->params, "ilsat").i; + if (land <= 0 || land > 5) E_ERROR(-28); + path = pj_param(P->params, "ipath").i; + if (path <= 0 || path > (land <= 3 ? 251 : 233)) E_ERROR(-29); + if (land <= 3) { + P->lam0 = DEG_TO_RAD * 128.87 - TWOPI / 251. * path; + P->p22 = 103.2669323; + alf = DEG_TO_RAD * 99.092; + } else { + P->lam0 = DEG_TO_RAD * 129.3 - TWOPI / 233. * path; + P->p22 = 98.8841202; + alf = DEG_TO_RAD * 98.2; + } + P->p22 /= 1440.; + P->sa = sin(alf); + P->ca = cos(alf); + if (fabs(P->ca) < 1e-9) + P->ca = 1e-9; + esc = P->es * P->ca * P->ca; + ess = P->es * P->sa * P->sa; + P->w = (1. - esc) * P->rone_es; + P->w = P->w * P->w - 1.; + P->q = ess * P->rone_es; + P->t = ess * (2. - P->es) * P->rone_es * P->rone_es; + P->u = esc * P->rone_es; + P->xj = P->one_es * P->one_es * P->one_es; + P->rlm = PI * (1. / 248. + .5161290322580645); + P->rlm2 = P->rlm + TWOPI; + P->a2 = P->a4 = P->b = P->c1 = P->c3 = 0.; + seraz0(0., 1., P); + for (lam = 9.; lam <= 81.0001; lam += 18.) + seraz0(lam, 4., P); + for (lam = 18; lam <= 72.0001; lam += 18.) + seraz0(lam, 2., P); + seraz0(90., 1., P); + P->a2 /= 30.; + P->a4 /= 60.; + P->b /= 30.; + P->c1 /= 15.; + P->c3 /= 45.; + P->inv = e_inverse; P->fwd = e_forward; +ENDENTRY(P) diff --git a/src/PJ_mbt_fps.c b/src/PJ_mbt_fps.c new file mode 100644 index 00000000..35fb7320 --- /dev/null +++ b/src/PJ_mbt_fps.c @@ -0,0 +1,41 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_mbt_fps.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(mbt_fps, "McBryde-Thomas Flat-Pole Sine (No. 2)") "\n\tCyl., Sph."; +#define MAX_ITER 10 +#define LOOP_TOL 1e-7 +#define C1 0.45503 +#define C2 1.36509 +#define C3 1.41546 +#define C_x 0.22248 +#define C_y 1.44492 +#define C1_2 0.33333333333333333333333333 +FORWARD(s_forward); /* spheroid */ + double k, V, t; + int i; + + k = C3 * sin(lp.phi); + for (i = MAX_ITER; i ; --i) { + t = lp.phi / C2; + lp.phi -= V = (C1 * sin(t) + sin(lp.phi) - k) / + (C1_2 * cos(t) + cos(lp.phi)); + if (fabs(V) < LOOP_TOL) + break; + } + t = lp.phi / C2; + xy.x = C_x * lp.lam * (1. + 3. * cos(lp.phi)/cos(t) ); + xy.y = C_y * sin(t); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double t, s; + + lp.phi = C2 * (t = aasin(xy.y / C_y)); + lp.lam = xy.x / (C_x * (1. + 3. * cos(lp.phi)/cos(t))); + lp.phi = aasin((C1 * sin(t) + sin(lp.phi)) / C3); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(mbt_fps) P->es = 0; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_mbtfpp.c b/src/PJ_mbtfpp.c new file mode 100644 index 00000000..d2f8f18b --- /dev/null +++ b/src/PJ_mbtfpp.c @@ -0,0 +1,35 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_mbtfpp.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") "\n\tCyl., Sph."; +#define CS .95257934441568037152 +#define FXC .92582009977255146156 +#define FYC 3.40168025708304504493 +#define C23 .66666666666666666666 +#define C13 .33333333333333333333 +#define ONEEPS 1.0000001 +FORWARD(s_forward); /* spheroid */ + lp.phi = asin(CS * sin(lp.phi)); + xy.x = FXC * lp.lam * (2. * cos(C23 * lp.phi) - 1.); + xy.y = FYC * sin(C13 * lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / FYC; + if (fabs(lp.phi) >= 1.) { + if (fabs(lp.phi) > ONEEPS) I_ERROR + else lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; + } else + lp.phi = asin(lp.phi); + lp.lam = xy.x / ( FXC * (2. * cos(C23 * (lp.phi *= 3.)) - 1.) ); + if (fabs(lp.phi = sin(lp.phi) / CS) >= 1.) { + if (fabs(lp.phi) > ONEEPS) I_ERROR + else lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; + } else + lp.phi = asin(lp.phi); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(mbtfpp) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_mbtfpq.c b/src/PJ_mbtfpq.c new file mode 100644 index 00000000..9827ffcc --- /dev/null +++ b/src/PJ_mbtfpq.c @@ -0,0 +1,50 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_mbtfpq.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(mbtfpq, "McBryde-Thomas Flat-Polar Quartic") "\n\tCyl., Sph."; +#define NITER 20 +#define EPS 1e-7 +#define ONETOL 1.000001 +#define C 1.70710678118654752440 +#define RC 0.58578643762690495119 +#define FYC 1.87475828462269495505 +#define RYC 0.53340209679417701685 +#define FXC 0.31245971410378249250 +#define RXC 3.20041258076506210122 +FORWARD(s_forward); /* spheroid */ + double th1, c; + int i; + + c = C * sin(lp.phi); + for (i = NITER; i; --i) { + lp.phi -= th1 = (sin(.5*lp.phi) + sin(lp.phi) - c) / + (.5*cos(.5*lp.phi) + cos(lp.phi)); + if (fabs(th1) < EPS) break; + } + xy.x = FXC * lp.lam * (1.0 + 2. * cos(lp.phi)/cos(0.5 * lp.phi)); + xy.y = FYC * sin(0.5 * lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double t; + + lp.phi = RYC * xy.y; + if (fabs(lp.phi) > 1.) { + if (fabs(lp.phi) > ONETOL) I_ERROR + else if (lp.phi < 0.) { t = -1.; lp.phi = -PI; } + else { t = 1.; lp.phi = PI; } + } else + lp.phi = 2. * asin(t = lp.phi); + lp.lam = RXC * xy.x / (1. + 2. * cos(lp.phi)/cos(0.5 * lp.phi)); + lp.phi = RC * (t + sin(lp.phi)); + if (fabs(lp.phi) > 1.) + if (fabs(lp.phi) > ONETOL) I_ERROR + else lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + else + lp.phi = asin(lp.phi); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(mbtfpq) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_merc.c b/src/PJ_merc.c new file mode 100644 index 00000000..63bc3341 --- /dev/null +++ b/src/PJ_merc.c @@ -0,0 +1,50 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_merc.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(merc, "Mercator") "\n\tCyl, Sph&Ell\n\tlat_ts="; +#define EPS10 1.e-10 +FORWARD(e_forward); /* ellipsoid */ + if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) F_ERROR; + xy.x = P->k0 * lp.lam; + xy.y = - P->k0 * log(pj_tsfn(lp.phi, sin(lp.phi), P->e)); + return (xy); +} +FORWARD(s_forward); /* spheroid */ + if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) F_ERROR; + xy.x = P->k0 * lp.lam; + xy.y = P->k0 * log(tan(FORTPI + .5 * lp.phi)); + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + if ((lp.phi = pj_phi2(exp(- xy.y / P->k0), P->e)) == HUGE_VAL) I_ERROR; + lp.lam = xy.x / P->k0; + return (lp); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = HALFPI - 2. * atan(exp(-xy.y / P->k0)); + lp.lam = xy.x / P->k0; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(merc) + double phits; + int is_phits; + + if (is_phits = pj_param(P->params, "tlat_ts").i) { + phits = fabs(pj_param(P->params, "rlat_ts").f); + if (phits >= HALFPI) E_ERROR(-24); + } + if (P->es) { /* ellipsoid */ + if (is_phits) + P->k0 = pj_msfn(sin(phits), cos(phits), P->es); + P->inv = e_inverse; + P->fwd = e_forward; + } else { /* sphere */ + if (is_phits) + P->k0 = cos(phits); + P->inv = s_inverse; + P->fwd = s_forward; + } +ENDENTRY(P) diff --git a/src/PJ_mill.c b/src/PJ_mill.c new file mode 100644 index 00000000..a9e40a74 --- /dev/null +++ b/src/PJ_mill.c @@ -0,0 +1,18 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_mill.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(mill, "Miller Cylindrical") "\n\tCyl, Sph"; +FORWARD(s_forward); /* spheroid */ + xy.x = lp.lam; + xy.y = log(tan(FORTPI + lp.phi * .4)) * 1.25; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.lam = xy.x; + lp.phi = 2.5 * (atan(exp(.8 * xy.y)) - FORTPI); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(mill) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_mod_ster.c b/src/PJ_mod_ster.c new file mode 100644 index 00000000..04fecb68 --- /dev/null +++ b/src/PJ_mod_ster.c @@ -0,0 +1,214 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_mod_ster.c 4.1 94/02/15 GIE REL"; +#endif +/* based upon Snyder and Linck, USGS-NMD */ +#define PROJ_PARMS__ \ + COMPLEX *zcoeff; \ + double cchio, schio; \ + int n; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(mil_os, "Miller Oblated Stereographic") "\n\tAzi(mod)"; +PROJ_HEAD(lee_os, "Lee Oblated Stereographic") "\n\tAzi(mod)"; +PROJ_HEAD(gs48, "Mod. Stererographics of 48 U.S.") "\n\tAzi(mod)"; +PROJ_HEAD(alsk, "Mod. Stererographics of Alaska") "\n\tAzi(mod)"; +PROJ_HEAD(gs50, "Mod. Stererographics of 50 U.S.") "\n\tAzi(mod)"; +#define EPSLN 1e-10 + +FORWARD(e_forward); /* ellipsoid */ + double sinlon, coslon, esphi, chi, schi, cchi, s; + COMPLEX p; + + sinlon = sin(lp.lam); + coslon = cos(lp.lam); + esphi = P->e * sin(lp.phi); + chi = 2. * atan(tan((HALFPI + lp.phi) * .5) * + pow((1. - esphi) / (1. + esphi), P->e * .5)) - HALFPI; + schi = sin(chi); + cchi = cos(chi); + s = 2. / (1. + P->schio * schi + P->cchio * cchi * coslon); + p.r = s * cchi * sinlon; + p.i = s * (P->cchio * schi - P->schio * cchi * coslon); + p = pj_zpoly1(p, P->zcoeff, P->n); + xy.x = p.r; + xy.y = p.i; + return xy; +} +INVERSE(e_inverse); /* ellipsoid */ + int nn; + COMPLEX p, fxy, fpxy, dp; + double den, rh, z, sinz, cosz, chi, phi, dphi, esphi; + + p.r = xy.x; + p.i = xy.y; + for (nn = 20; nn ;--nn) { + fxy = pj_zpolyd1(p, P->zcoeff, P->n, &fpxy); + fxy.r -= xy.x; + fxy.i -= xy.y; + den = fpxy.r * fpxy.r + fpxy.i * fpxy.i; + dp.r = -(fxy.r * fpxy.r + fxy.i * fpxy.i) / den; + dp.i = -(fxy.i * fpxy.r - fxy.r * fpxy.i) / den; + p.r += dp.r; + p.i += dp.i; + if ((fabs(dp.r) + fabs(dp.i)) <= EPSLN) + break; + } + if (nn) { + rh = hypot(p.r, p.i); + z = 2. * atan(.5 * rh); + sinz = sin(z); + cosz = cos(z); + lp.lam = P->lam0; + if (fabs(rh) <= EPSLN) { + lp.phi = P->phi0; + return lp; + } + chi = aasin(cosz * P->schio + p.i * sinz * P->cchio / rh); + phi = chi; + for (nn = 20; nn ;--nn) { + esphi = P->e * sin(phi); + dphi = 2. * atan(tan((HALFPI + chi) * .5) * + pow((1. + esphi) / (1. - esphi), P->e * .5)) - HALFPI - phi; + phi += dphi; + if (fabs(dphi) <= EPSLN) + break; + } + } + if (nn) { + lp.phi = phi; + lp.lam = atan2(p.r * sinz, rh * P->cchio * cosz - p.i * + P->schio * sinz); + } else + lp.lam = lp.phi = HUGE_VAL; + return lp; +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { /* general initialization */ + double esphi, chio; + + if (P->es) { + esphi = P->e * sin(P->phi0); + chio = 2. * atan(tan((HALFPI + P->phi0) * .5) * + pow((1. - esphi) / (1. + esphi), P->e * .5)) - HALFPI; + } else + chio = P->phi0; + P->schio = sin(chio); + P->cchio = cos(chio); + P->inv = e_inverse; P->fwd = e_forward; + return P; +} +ENTRY0(mil_os) + static COMPLEX /* Miller Oblated Stereographic */ +AB[] = { + 0.924500, 0., + 0., 0., + 0.019430, 0. +}; + + P->n = 2; + P->lam0 = DEG_TO_RAD * 20.; + P->phi0 = DEG_TO_RAD * 18.; + P->zcoeff = AB; + P->es = 0.; +ENDENTRY(setup(P)) +ENTRY0(lee_os) + static COMPLEX /* Lee Oblated Stereographic */ +AB[] = { + 0.721316, 0., + 0., 0., + -0.0088162, -0.00617325 +}; + + P->n = 2; + P->lam0 = DEG_TO_RAD * -165.; + P->phi0 = DEG_TO_RAD * -10.; + P->zcoeff = AB; + P->es = 0.; +ENDENTRY(setup(P)) +ENTRY0(gs48) + static COMPLEX /* 48 United States */ +AB[] = { + 0.98879, 0., + 0., 0., + -0.050909, 0., + 0., 0., + 0.075528, 0. +}; + + P->n = 4; + P->lam0 = DEG_TO_RAD * -96.; + P->phi0 = DEG_TO_RAD * -39.; + P->zcoeff = AB; + P->es = 0.; + P->a = 6370997.; +ENDENTRY(setup(P)) +ENTRY0(alsk) + static COMPLEX +ABe[] = { /* Alaska ellipsoid */ + .9945303, 0., + .0052083, -.0027404, + .0072721, .0048181, + -.0151089, -.1932526, + .0642675, -.1381226, + .3582802, -.2884586}, +ABs[] = { /* Alaska sphere */ + .9972523, 0., + .0052513, -.0041175, + .0074606, .0048125, + -.0153783, -.1968253, + .0636871, -.1408027, + .3660976, -.2937382 +}; + + P->n = 5; + P->lam0 = DEG_TO_RAD * -152.; + P->phi0 = DEG_TO_RAD * 64.; + if (P->es) { /* fixed ellipsoid/sphere */ + P->zcoeff = ABe; + P->a = 6378206.4; + P->e = sqrt(P->es = 0.00676866); + } else { + P->zcoeff = ABs; + P->a = 6370997.; + } +ENDENTRY(setup(P)) +ENTRY0(gs50) + static COMPLEX +ABe[] = { /* GS50 ellipsoid */ + .9827497, 0., + .0210669, .0053804, + -.1031415, -.0571664, + -.0323337, -.0322847, + .0502303, .1211983, + .0251805, .0895678, + -.0012315, -.1416121, + .0072202, -.1317091, + -.0194029, .0759677, + -.0210072, .0834037 +}, +ABs[] = { /* GS50 sphere */ + .9842990, 0., + .0211642, .0037608, + -.1036018, -.0575102, + -.0329095, -.0320119, + .0499471, .1223335, + .0260460, .0899805, + .0007388, -.1435792, + .0075848, -.1334108, + -.0216473, .0776645, + -.0225161, .0853673 +}; + + P->n = 9; + P->lam0 = DEG_TO_RAD * -120.; + P->phi0 = DEG_TO_RAD * 45.; + if (P->es) { /* fixed ellipsoid/sphere */ + P->zcoeff = ABe; + P->a = 6378206.4; + P->e = sqrt(P->es = 0.00676866); + } else { + P->zcoeff = ABs; + P->a = 6370997.; + } +ENDENTRY(setup(P)) diff --git a/src/PJ_moll.c b/src/PJ_moll.c new file mode 100644 index 00000000..35d61b67 --- /dev/null +++ b/src/PJ_moll.c @@ -0,0 +1,65 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_moll.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double C_x, C_y, C_p; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(moll, "Mollweide") "\n\tPCyl., Sph."; +PROJ_HEAD(wag4, "Wagner IV") "\n\tPCyl., Sph."; +PROJ_HEAD(wag5, "Wagner V") "\n\tPCyl., Sph."; +#define MAX_ITER 10 +#define LOOP_TOL 1e-7 +FORWARD(s_forward); /* spheroid */ + double k, V; + int i; + + k = P->C_p * sin(lp.phi); + for (i = MAX_ITER; i ; --i) { + lp.phi -= V = (lp.phi + sin(lp.phi) - k) / + (1. + cos(lp.phi)); + if (fabs(V) < LOOP_TOL) + break; + } + if (!i) + lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; + else + lp.phi *= 0.5; + xy.x = P->C_x * lp.lam * cos(lp.phi); + xy.y = P->C_y * sin(lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double th, s; + + lp.phi = aasin(xy.y / P->C_y); + lp.lam = xy.x / (P->C_x * cos(lp.phi)); + lp.phi += lp.phi; + lp.phi = aasin((lp.phi + sin(lp.phi)) / P->C_p); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P, double p) { + double r, sp, p2 = p + p; + + P->es = 0; + sp = sin(p); + r = sqrt(TWOPI * sp / (p2 + sin(p2))); + P->C_x = 2. * r / PI; + P->C_y = r / sp; + P->C_p = p2 + sin(p2); + P->inv = s_inverse; + P->fwd = s_forward; + return P; +} +ENTRY0(moll) ENDENTRY(setup(P, HALFPI)) +ENTRY0(wag4) ENDENTRY(setup(P, PI/3.)) +ENTRY0(wag5) + P->es = 0; + P->C_x = 0.90977; + P->C_y = 1.65014; + P->C_p = 3.00896; + P->inv = s_inverse; + P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_mpoly.c b/src/PJ_mpoly.c new file mode 100644 index 00000000..4b566993 --- /dev/null +++ b/src/PJ_mpoly.c @@ -0,0 +1,21 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_mpoly.c 4.1 94/05/22 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double rho_0; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(mpoly, "Modified Polyconic") + "\n\tPolyconic, Sph\n\tlat_1= and lat_2= lotsa"; +FORWARD(s_forward); /* spheroid */ + return (xy); +} +INVERSE(s_inverse); /* ellipsoid & spheroid */ + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(mpoly) + P->fwd = s_forward; + P->inv = s_inverse; + P->es = 0; +ENDENTRY(P) diff --git a/src/PJ_nell.c b/src/PJ_nell.c new file mode 100644 index 00000000..9473eff4 --- /dev/null +++ b/src/PJ_nell.c @@ -0,0 +1,34 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_nell.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(nell, "Nell") "\n\tPCyl., Sph."; +#define MAX_ITER 10 +#define LOOP_TOL 1e-7 +FORWARD(s_forward); /* spheroid */ + double k, V; + int i; + + k = 2. * sin(lp.phi); + V = lp.phi * lp.phi; + lp.phi *= 1.00371 + V * (-0.0935382 + V * -0.011412); + for (i = MAX_ITER; i ; --i) { + lp.phi -= V = (lp.phi + sin(lp.phi) - k) / + (1. + cos(lp.phi)); + if (fabs(V) < LOOP_TOL) + break; + } + xy.x = 0.5 * lp.lam * (1. + cos(lp.phi)); + xy.y = lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double th, s; + + lp.lam = 2. * xy.x / (1. + cos(xy.y)); + lp.phi = aasin(0.5 * (xy.y + sin(xy.y))); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(nell) P->es = 0; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_nell_h.c b/src/PJ_nell_h.c new file mode 100644 index 00000000..3e87abec --- /dev/null +++ b/src/PJ_nell_h.c @@ -0,0 +1,33 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_nell_h.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(nell_h, "Nell-Hammer") "\n\tPCyl., Sph."; +#define NITER 9 +#define EPS 1e-7 +FORWARD(s_forward); /* spheroid */ + xy.x = 0.5 * lp.lam * (1. + cos(lp.phi)); + xy.y = 2.0 * (lp.phi - tan(0.5 *lp.phi)); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double V, c, p; + int i; + + p = 0.5 * xy.y; + for (i = NITER; i ; --i) { + c = cos(0.5 * lp.phi); + lp.phi -= V = (lp.phi - tan(lp.phi/2) - p)/(1. - 0.5/(c*c)); + if (fabs(V) < EPS) + break; + } + if (!i) { + lp.phi = p < 0. ? -HALFPI : HALFPI; + lp.lam = 2. * xy.x; + } else + lp.lam = 2. * xy.x / (1. + cos(lp.phi)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(nell_h) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_nocol.c b/src/PJ_nocol.c new file mode 100644 index 00000000..d9aec5ad --- /dev/null +++ b/src/PJ_nocol.c @@ -0,0 +1,41 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_nocol.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(nicol, "Nicolosi Globular") "\n\tMisc Sph, no inv."; +#define EPS 1e-10 +FORWARD(s_forward); /* spheroid */ + if (fabs(lp.lam) < EPS) { + xy.x = 0; + xy.y = lp.phi; + } else if (fabs(lp.phi) < EPS) { + xy.x = lp.lam; + xy.y = 0.; + } else if (fabs(fabs(lp.lam) - HALFPI) < EPS) { + xy.x = lp.lam * cos(lp.phi); + xy.y = HALFPI * sin(lp.phi); + } else if (fabs(fabs(lp.phi) - HALFPI) < EPS) { + xy.x = 0; + xy.y = lp.phi; + } else { + double tb, c, d, m, n, r2, sp; + + tb = HALFPI / lp.lam - lp.lam / HALFPI; + c = lp.phi / HALFPI; + d = (1 - c * c)/((sp = sin(lp.phi)) - c); + r2 = tb / d; + r2 *= r2; + m = (tb * sp / d - 0.5 * tb)/(1. + r2); + n = (sp / r2 + 0.5 * d)/(1. + 1./r2); + xy.x = cos(lp.phi); + xy.x = sqrt(m * m + xy.x * xy.x / (1. + r2)); + xy.x = HALFPI * ( m + (lp.lam < 0. ? -xy.x : xy.x)); + xy.y = sqrt(n * n - (sp * sp / r2 + d * sp - 1.) / + (1. + 1./r2)); + xy.y = HALFPI * ( n + (lp.phi < 0. ? xy.y : -xy.y )); + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(nicol) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_nsper.c b/src/PJ_nsper.c new file mode 100644 index 00000000..6b430a84 --- /dev/null +++ b/src/PJ_nsper.c @@ -0,0 +1,152 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_nsper.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double height; \ + double sinph0; \ + double cosph0; \ + double p; \ + double rp; \ + double pn1; \ + double pfact; \ + double h; \ + double cg; \ + double sg; \ + double sw; \ + double cw; \ + int mode; \ + int tilt; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(nsper, "Near-sided perspective") "\n\tAzi, Sph\n\th="; +PROJ_HEAD(tpers, "Tilted perspective") "\n\tAzi, Sph\n\ttilt= azi= h="; +# define EPS10 1.e-10 +# define N_POLE 0 +# define S_POLE 1 +# define EQUIT 2 +# define OBLIQ 3 +FORWARD(s_forward); /* spheroid */ + double coslam, cosphi, sinphi; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + switch (P->mode) { + case OBLIQ: + xy.y = P->sinph0 * sinphi + P->cosph0 * cosphi * coslam; + break; + case EQUIT: + xy.y = cosphi * coslam; + break; + case S_POLE: + xy.y = - sinphi; + break; + case N_POLE: + xy.y = sinphi; + break; + } + if (xy.y < P->rp) F_ERROR; + xy.y = P->pn1 / (P->p - xy.y); + xy.x = xy.y * cosphi * sin(lp.lam); + switch (P->mode) { + case OBLIQ: + xy.y *= (P->cosph0 * sinphi - + P->sinph0 * cosphi * coslam); + break; + case EQUIT: + xy.y *= sinphi; + break; + case N_POLE: + coslam = - coslam; + case S_POLE: + xy.y *= cosphi * coslam; + break; + } + if (P->tilt) { + double yt, ba; + + yt = xy.y * P->cg + xy.x * P->sg; + ba = 1. / (yt * P->sw * P->h + P->cw); + xy.x = (xy.x * P->cg - xy.y * P->sg) * P->cw * ba; + xy.y = yt * ba; + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double rh, cosz, sinz; + + if (P->tilt) { + double bm, bq, yt; + + yt = 1./(P->pn1 - xy.y * P->sw); + bm = P->pn1 * xy.x * yt; + bq = P->pn1 * xy.y * P->cw * yt; + xy.x = bm * P->cg + bq * P->sg; + xy.y = bq * P->cg - bm * P->sg; + } + rh = hypot(xy.x, xy.y); + if ((sinz = 1. - rh * rh * P->pfact) < 0.) I_ERROR; + sinz = (P->p - sqrt(sinz)) / (P->pn1 / rh + rh / P->pn1); + cosz = sqrt(1. - sinz * sinz); + if (fabs(rh) <= EPS10) { + lp.lam = 0.; + lp.phi = P->phi0; + } else { + switch (P->mode) { + case OBLIQ: + lp.phi = asin(cosz * P->sinph0 + xy.y * sinz * P->cosph0 / rh); + xy.y = (cosz - P->sinph0 * sin(lp.phi)) * rh; + xy.x *= sinz * P->cosph0; + break; + case EQUIT: + lp.phi = asin(xy.y * sinz / rh); + xy.y = cosz * rh; + xy.x *= sinz; + break; + case N_POLE: + lp.phi = asin(cosz); + xy.y = -xy.y; + break; + case S_POLE: + lp.phi = - asin(cosz); + break; + } + lp.lam = atan2(xy.x, xy.y); + } + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + if ((P->height = pj_param(P->params, "dh").f) <= 0.) E_ERROR(-30); + if (fabs(fabs(P->phi0) - HALFPI) < EPS10) + P->mode = P->phi0 < 0. ? S_POLE : N_POLE; + else if (fabs(P->phi0) < EPS10) + P->mode = EQUIT; + else { + P->mode = OBLIQ; + P->sinph0 = sin(P->phi0); + P->cosph0 = cos(P->phi0); + } + P->pn1 = P->height / P->a; /* normalize by radius */ + P->p = 1. + P->pn1; + P->rp = 1. / P->p; + P->h = 1. / P->pn1; + P->pfact = (P->p + 1.) * P->h; + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; + return P; +} +ENTRY0(nsper) + P->tilt = 0; +ENDENTRY(setup(P)) +ENTRY0(tpers) + double omega, gamma; + + omega = pj_param(P->params, "dtilt").f * DEG_TO_RAD; + gamma = pj_param(P->params, "dazi").f * DEG_TO_RAD; + P->tilt = 1; + P->cg = cos(gamma); P->sg = sin(gamma); + P->cw = cos(omega); P->sw = sin(omega); +ENDENTRY(setup(P)) diff --git a/src/PJ_nzmg.c b/src/PJ_nzmg.c new file mode 100644 index 00000000..fabe32a1 --- /dev/null +++ b/src/PJ_nzmg.c @@ -0,0 +1,77 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_nzmg.c 4.1 94/02/15 GIE REL"; +#endif +/* very loosely based upon DMA code by Bradford W. Drew */ +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(nzmg, "New Zealand Map Grid") "\n\tfixed Earth"; +#define EPSLN 1e-10 +#define SEC5_TO_RAD 0.4848136811095359935899141023 +#define RAD_TO_SEC5 2.062648062470963551564733573 + static COMPLEX +bf[] = { + .7557853228, 0.0, + .249204646, .003371507, + -.001541739, .041058560, + -.10162907, .01727609, + -.26623489, -.36249218, + -.6870983, -1.1651967 }; + static double +tphi[] = { 1.5627014243, .5185406398, -.03333098, -.1052906, -.0368594, + .007317, .01220, .00394, -.0013 }, +tpsi[] = { .6399175073, -.1358797613, .063294409, -.02526853, .0117879, + -.0055161, .0026906, -.001333, .00067, -.00034 }; +#define Nbf 5 +#define Ntpsi 9 +#define Ntphi 8 +FORWARD(e_forward); /* ellipsoid */ + COMPLEX p; + double *C; + int i; + + lp.phi = (lp.phi - P->phi0) * RAD_TO_SEC5; + for (p.r = *(C = tpsi + (i = Ntpsi)); i ; --i) + p.r = *--C + lp.phi * p.r; + p.r *= lp.phi; + p.i = lp.lam; + p = pj_zpoly1(p, bf, Nbf); + xy.x = p.i; + xy.y = p.r; + return xy; +} +INVERSE(e_inverse); /* ellipsoid */ + int nn, i; + COMPLEX p, f, fp, dp; + double den, *C; + + p.r = xy.y; + p.i = xy.x; + for (nn = 20; nn ;--nn) { + f = pj_zpolyd1(p, bf, Nbf, &fp); + f.r -= xy.y; + f.i -= xy.x; + den = fp.r * fp.r + fp.i * fp.i; + p.r += dp.r = -(f.r * fp.r + f.i * fp.i) / den; + p.i += dp.i = -(f.i * fp.r - f.r * fp.i) / den; + if ((fabs(dp.r) + fabs(dp.i)) <= EPSLN) + break; + } + if (nn) { + lp.lam = p.i; + for (lp.phi = *(C = tphi + (i = Ntphi)); i ; --i) + lp.phi = *--C + p.r * lp.phi; + lp.phi = P->phi0 + p.r * lp.phi * SEC5_TO_RAD; + } else + lp.lam = lp.phi = HUGE_VAL; + return lp; +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(nzmg) + /* force to International major axis */ + P->ra = 1. / (P->a = 6378388.0); + P->lam0 = DEG_TO_RAD * 173.; + P->phi0 = DEG_TO_RAD * -41.; + P->x0 = 2510000.; + P->y0 = 6023150.; + P->inv = e_inverse; P->fwd = e_forward; +ENDENTRY(P) diff --git a/src/PJ_ob_tran.c b/src/PJ_ob_tran.c new file mode 100644 index 00000000..d02878c9 --- /dev/null +++ b/src/PJ_ob_tran.c @@ -0,0 +1,142 @@ +#ifndef lint +static char SCCSID[]="@(#)PJ_ob_tran.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + struct PJconsts *link; \ + double lamp; \ + double cphip, sphip; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(ob_tran, "General Oblique Transformation") "\n\tMisc Sph" +"\n\to_proj= plus parameters for projection" +"\n\to_lat_p= o_lon_p= (new pole) or" +"\n\to_alpha= o_lon_c= o_lat_c= or" +"\n\to_lon_1= o_lat_1= o_lon_2= o_lat_2="; +#define TOL 1e-10 +FORWARD(o_forward); /* spheroid */ + double coslam, sinphi, cosphi; + + coslam = cos(lp.lam); + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + lp.lam = adjlon(aatan2(cosphi * sin(lp.lam), P->sphip * cosphi * coslam + + P->cphip * sinphi) + P->lamp); + lp.phi = aasin(P->sphip * sinphi - P->cphip * cosphi * coslam); + return (P->link->fwd(lp, P->link)); +} +FORWARD(t_forward); /* spheroid */ + double cosphi, coslam; + + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + lp.lam = adjlon(aatan2(cosphi * sin(lp.lam), sin(lp.phi)) + P->lamp); + lp.phi = aasin(- cosphi * coslam); + return (P->link->fwd(lp, P->link)); +} +INVERSE(o_inverse); /* spheroid */ + double coslam, sinphi, cosphi; + + lp = P->link->inv(xy, P->link); + if (lp.lam != HUGE_VAL) { + coslam = cos(lp.lam -= P->lamp); + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + lp.phi = aasin(P->sphip * sinphi + P->cphip * cosphi * coslam); + lp.lam = aatan2(cosphi * sin(lp.lam), P->sphip * cosphi * coslam - + P->cphip * sinphi); + } + return (lp); +} +INVERSE(t_inverse); /* spheroid */ + double cosphi, t; + + lp = P->link->inv(xy, P->link); + if (lp.lam != HUGE_VAL) { + cosphi = cos(lp.phi); + t = lp.lam - P->lamp; + lp.lam = aatan2(cosphi * sin(t), - sin(lp.phi)); + lp.phi = aasin(cosphi * cos(t)); + } + return (lp); +} +FREEUP; + if (P) { + if (P->link) + (*(P->link->pfree))(P->link); + pj_dalloc(P); + } +} +ENTRY1(ob_tran, link) + int i; + double phip; + char *name, *s; + + /* get name of projection to be translated */ + if (!(name = pj_param(P->params, "so_proj").s)) E_ERROR(-26); + for (i = 0; (s = pj_list[i].id) && strcmp(name, s) ; ++i) ; + if (!s || !(P->link = (*pj_list[i].proj)(0))) E_ERROR(-37); + /* copy existing header into new */ + P->es = 0.; /* force to spherical */ + P->link->params = P->params; + P->link->over = P->over; + P->link->geoc = P->geoc; + P->link->a = P->a; + P->link->es = P->es; + P->link->ra = P->ra; + P->link->lam0 = P->lam0; + P->link->phi0 = P->phi0; + P->link->x0 = P->x0; + P->link->y0 = P->y0; + P->link->k0 = P->k0; + /* force spherical earth */ + P->link->one_es = P->link->rone_es = 1.; + P->link->es = P->link->e = 0.; + if (!(P->link = pj_list[i].proj(P->link))) { + freeup(P); + return 0; + } + if (pj_param(P->params, "to_alpha").i) { + double lamc, phic, alpha; + + lamc = pj_param(P->params, "ro_lon_c").f; + phic = pj_param(P->params, "ro_lat_c").f; + alpha = pj_param(P->params, "ro_alpha").f; +/* + if (fabs(phic) <= TOL || + fabs(fabs(phic) - HALFPI) <= TOL || + fabs(fabs(alpha) - HALFPI) <= TOL) +*/ + if (fabs(fabs(phic) - HALFPI) <= TOL) + E_ERROR(-32); + P->lamp = lamc + aatan2(-cos(alpha), -sin(alpha) * sin(phic)); + phip = aasin(cos(phic) * sin(alpha)); + } else if (pj_param(P->params, "to_lat_p").i) { /* specified new pole */ + P->lamp = pj_param(P->params, "ro_lon_p").f; + phip = pj_param(P->params, "ro_lat_p").f; + } else { /* specified new "equator" points */ + double lam1, lam2, phi1, phi2, con; + + lam1 = pj_param(P->params, "ro_lon_1").f; + phi1 = pj_param(P->params, "ro_lat_1").f; + lam2 = pj_param(P->params, "ro_lon_2").f; + phi2 = pj_param(P->params, "ro_lat_2").f; + if (fabs(phi1 - phi2) <= TOL || + (con = fabs(phi1)) <= TOL || + fabs(con - HALFPI) <= TOL || + fabs(fabs(phi2) - HALFPI) <= TOL) E_ERROR(-33); + P->lamp = atan2(cos(phi1) * sin(phi2) * cos(lam1) - + sin(phi1) * cos(phi2) * cos(lam2), + sin(phi1) * cos(phi2) * sin(lam2) - + cos(phi1) * sin(phi2) * sin(lam1)); + phip = atan(-cos(P->lamp - lam1) / tan(phi1)); + } + if (fabs(phip) > TOL) { /* oblique */ + P->cphip = cos(phip); + P->sphip = sin(phip); + P->fwd = o_forward; + P->inv = P->link->inv ? o_inverse : 0; + } else { /* transverse */ + P->fwd = t_forward; + P->inv = P->link->inv ? t_inverse : 0; + } +ENDENTRY(P) diff --git a/src/PJ_ocea.c b/src/PJ_ocea.c new file mode 100644 index 00000000..95fcda0d --- /dev/null +++ b/src/PJ_ocea.c @@ -0,0 +1,71 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_ocea.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double rok; \ + double rtk; \ + double sinphi; \ + double cosphi; \ + double singam; \ + double cosgam; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(ocea, "Oblique Cylindrical Equal Area") "\n\tCyl, Sph" + "lonc= alpha= or\n\tlat_1= lat_2= lon_1= lon_2="; +FORWARD(s_forward); /* spheroid */ + double t; + + xy.y = sin(lp.lam); +/* + xy.x = atan2((tan(lp.phi) * P->cosphi + P->sinphi * xy.y) , cos(lp.lam)); +*/ + t = cos(lp.lam); + xy.x = atan((tan(lp.phi) * P->cosphi + P->sinphi * xy.y) / t); + if (t < 0.) + xy.x += PI; + xy.x *= P->rtk; + xy.y = P->rok * (P->sinphi * sin(lp.phi) - P->cosphi * cos(lp.phi) * xy.y); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double t, s; + + xy.y /= P->rok; + xy.x /= P->rtk; + t = sqrt(1. - xy.y * xy.y); + lp.phi = asin(xy.y * P->sinphi + t * P->cosphi * (s = sin(xy.x))); + lp.lam = atan2(t * P->sinphi * s - xy.y * P->cosphi, + t * cos(xy.x)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(ocea) + double phi_0, phi_1, phi_2, lam_1, lam_2, lonz, alpha; + + P->rok = P->a / P->k0; + P->rtk = P->a * P->k0; + if ( pj_param(P->params, "talpha").i) { + alpha = pj_param(P->params, "ralpha").f; + lonz = pj_param(P->params, "rlonc").f; + P->singam = atan(-cos(alpha)/(-sin(phi_0) * sin(alpha))) + lonz; + P->sinphi = asin(cos(phi_0) * sin(alpha)); + } else { + phi_1 = pj_param(P->params, "rlat_1").f; + phi_2 = pj_param(P->params, "rlat_2").f; + lam_1 = pj_param(P->params, "rlon_1").f; + lam_2 = pj_param(P->params, "rlon_2").f; + P->singam = atan2(cos(phi_1) * sin(phi_2) * cos(lam_1) - + sin(phi_1) * cos(phi_2) * cos(lam_2), + sin(phi_1) * cos(phi_2) * sin(lam_2) - + cos(phi_1) * sin(phi_2) * sin(lam_1) ); + P->sinphi = atan(-cos(P->singam - lam_1) / tan(phi_1)); + } + P->lam0 = P->singam + HALFPI; + P->cosphi = cos(P->sinphi); + P->sinphi = sin(P->sinphi); + P->cosgam = cos(P->singam); + P->singam = sin(P->singam); + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_oea.c b/src/PJ_oea.c new file mode 100644 index 00000000..dc890ef1 --- /dev/null +++ b/src/PJ_oea.c @@ -0,0 +1,61 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_oea.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double theta; \ + double m, n; \ + double two_r_m, two_r_n, rm, rn, hm, hn; \ + double cp0, sp0; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(oea, "Oblated Equal Area") "\n\tMisc Sph\n\tn= m= theta="; +FORWARD(s_forward); /* sphere */ + double Az, hz, M, N, cp, sp, cl, shz; + + cp = cos(lp.phi); + sp = sin(lp.phi); + cl = cos(lp.lam); + Az = aatan2(cp * sin(lp.lam), P->cp0 * sp - P->sp0 * cp * cl) + P->theta; + shz = sin(0.5 * aacos(P->sp0 * sp + P->cp0 * cp * cl)); + M = aasin(shz * sin(Az)); + N = aasin(shz * cos(Az) * cos(M) / cos(M * P->two_r_m)); + xy.y = P->n * sin(N * P->two_r_n); + xy.x = P->m * sin(M * P->two_r_m) * cos(N) / cos(N * P->two_r_n); + return (xy); +} +INVERSE(s_inverse); /* sphere */ + double N, M, xp, yp, z, Az, cz, sz, cAz; + + N = P->hn * aasin(xy.y * P->rn); + M = P->hm * aasin(xy.x * P->rm * cos(N * P->two_r_n) / cos(N)); + xp = 2. * sin(M); + yp = 2. * sin(N) * cos(M * P->two_r_m) / cos(M); + cAz = cos(Az = aatan2(xp, yp) - P->theta); + z = 2. * aasin(0.5 * hypot(xp, yp)); + sz = sin(z); + cz = cos(z); + lp.phi = aasin(P->sp0 * cz + P->cp0 * sz * cAz); + lp.lam = aatan2(sz * sin(Az), + P->cp0 * cz - P->sp0 * sz * cAz); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(oea) + if (((P->n = pj_param(P->params, "dn").f) <= 0.) || + ((P->m = pj_param(P->params, "dm").f) <= 0.)) + E_ERROR(-39) + else { + P->theta = pj_param(P->params, "rtheta").f; + P->sp0 = sin(P->phi0); + P->cp0 = cos(P->phi0); + P->rn = 1./ P->n; + P->rm = 1./ P->m; + P->two_r_n = 2. * P->rn; + P->two_r_m = 2. * P->rm; + P->hm = 0.5 * P->m; + P->hn = 0.5 * P->n; + P->fwd = s_forward; + P->inv = s_inverse; + P->es = 0.; + } +ENDENTRY(P) diff --git a/src/PJ_omerc.c b/src/PJ_omerc.c new file mode 100644 index 00000000..5494186b --- /dev/null +++ b/src/PJ_omerc.c @@ -0,0 +1,169 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_omerc.c 4.2 95/01/01 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double alpha, lamc, lam1, phi1, lam2, phi2, Gamma, al, bl, el, \ + singam, cosgam, sinrot, cosrot, u_0; \ + int ellips, rot; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(omerc, "Oblique Mercator") + "\n\tCyl, Sph&Ell\n\t no_rot rot_conv no_uoff and\n\t" +"alpha= lonc= or\n\t lon_1= lat_1= lon_2= lat_2="; +#define TOL 1.e-7 +#define EPS 1.e-10 +#define TSFN0(x) tan(.5 * (HALFPI - (x))) +FORWARD(e_forward); /* ellipsoid & spheroid */ + double con, q, s, ul, us, vl, vs; + + vl = sin(P->bl * lp.lam); + if (fabs(fabs(lp.phi) - HALFPI) <= EPS) { + ul = lp.phi < 0. ? -P->singam : P->singam; + us = P->al * lp.phi / P->bl; + } else { + q = P->el / (P->ellips ? pow(pj_tsfn(lp.phi, sin(lp.phi), P->e), P->bl) + : TSFN0(lp.phi)); + s = .5 * (q - 1. / q); + ul = 2. * (s * P->singam - vl * P->cosgam) / (q + 1. / q); + con = cos(P->bl * lp.lam); + if (fabs(con) >= TOL) { + us = P->al * atan((s * P->cosgam + vl * P->singam) / con) / P->bl; + if (con < 0.) + us += PI * P->al / P->bl; + } else + us = P->al * P->bl * lp.lam; + } + if (fabs(fabs(ul) - 1.) <= EPS) F_ERROR; + vs = .5 * P->al * log((1. - ul) / (1. + ul)) / P->bl; + us -= P->u_0; + if (! P->rot) { + xy.x = us; + xy.y = vs; + } else { + xy.x = vs * P->cosrot + us * P->sinrot; + xy.y = us * P->cosrot - vs * P->sinrot; + } + return (xy); +} +INVERSE(e_inverse); /* ellipsoid & spheroid */ + double q, s, ul, us, vl, vs; + + if (! P->rot) { + us = xy.x; + vs = xy.y; + } else { + vs = xy.x * P->cosrot - xy.y * P->sinrot; + us = xy.y * P->cosrot + xy.x * P->sinrot; + } + us += P->u_0; + q = exp(- P->bl * vs / P->al); + s = .5 * (q - 1. / q); + vl = sin(P->bl * us / P->al); + ul = 2. * (vl * P->cosgam + s * P->singam) / (q + 1. / q); + if (fabs(fabs(ul) - 1.) < EPS) { + lp.lam = 0.; + lp.phi = ul < 0. ? -HALFPI : HALFPI; + } else { + lp.phi = P->el / sqrt((1. + ul) / (1. - ul)); + if (P->ellips) { + if ((lp.phi = pj_phi2(pow(lp.phi, 1. / P->bl), P->e)) == HUGE_VAL) + I_ERROR; + } else + lp.phi = HALFPI - 2. * atan(lp.phi); + lp.lam = - atan2((s * P->cosgam - + vl * P->singam), cos(P->bl * us / P->al)) / P->bl; + } + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(omerc) + double con, com, cosph0, d, f, h, l, sinph0, p, j; + int azi; + + P->rot = pj_param(P->params, "bno_rot").i == 0; + if (azi = pj_param(P->params, "talpha").i) { + P->lamc = pj_param(P->params, "rlonc").f; + P->alpha = pj_param(P->params, "ralpha").f; + if ( fabs(P->alpha) <= TOL || + fabs(fabs(P->phi0) - HALFPI) <= TOL || + fabs(fabs(P->alpha) - HALFPI) <= TOL) + E_ERROR(-32); + } else { + P->lam1 = pj_param(P->params, "rlon_1").f; + P->phi1 = pj_param(P->params, "rlat_1").f; + P->lam2 = pj_param(P->params, "rlon_2").f; + P->phi2 = pj_param(P->params, "rlat_2").f; + if (fabs(P->phi1 - P->phi2) <= TOL || + (con = fabs(P->phi1)) <= TOL || + fabs(con - HALFPI) <= TOL || + fabs(fabs(P->phi0) - HALFPI) <= TOL || + fabs(fabs(P->phi2) - HALFPI) <= TOL) E_ERROR(-33); + } + com = (P->ellips = P->es > 0.) ? sqrt(P->one_es) : 1.; + if (fabs(P->phi0) > EPS) { + sinph0 = sin(P->phi0); + cosph0 = cos(P->phi0); + if (P->ellips) { + con = 1. - P->es * sinph0 * sinph0; + P->bl = cosph0 * cosph0; + P->bl = sqrt(1. + P->es * P->bl * P->bl / P->one_es); + P->al = P->bl * P->k0 * com / con; + d = P->bl * com / (cosph0 * sqrt(con)); + } else { + P->bl = 1.; + P->al = P->k0; + d = 1. / cosph0; + } + if ((f = d * d - 1.) <= 0.) + f = 0.; + else { + f = sqrt(f); + if (P->phi0 < 0.) + f = -f; + } + P->el = f += d; + if (P->ellips) P->el *= pow(pj_tsfn(P->phi0, sinph0, P->e), P->bl); + else P->el *= TSFN0(P->phi0); + } else { + P->bl = 1. / com; + P->al = P->k0; + P->el = d = f = 1.; + } + if (azi) { + P->Gamma = asin(sin(P->alpha) / d); + P->lam0 = P->lamc - asin((.5 * (f - 1. / f)) * + tan(P->Gamma)) / P->bl; + } else { + if (P->ellips) { + h = pow(pj_tsfn(P->phi1, sin(P->phi1), P->e), P->bl); + l = pow(pj_tsfn(P->phi2, sin(P->phi2), P->e), P->bl); + } else { + h = TSFN0(P->phi1); + l = TSFN0(P->phi2); + } + f = P->el / h; + p = (l - h) / (l + h); + j = P->el * P->el; + j = (j - l * h) / (j + l * h); + if ((con = P->lam1 - P->lam2) < -PI) + P->lam2 -= TWOPI; + else if (con > PI) + P->lam2 += TWOPI; + P->lam0 = adjlon(.5 * (P->lam1 + P->lam2) - atan( + j * tan(.5 * P->bl * (P->lam1 - P->lam2)) / p) / P->bl); + P->Gamma = atan(2. * sin(P->bl * adjlon(P->lam1 - P->lam0)) / + (f - 1. / f)); + P->alpha = asin(d * sin(P->Gamma)); + } + P->singam = sin(P->Gamma); + P->cosgam = cos(P->Gamma); + f = pj_param(P->params, "brot_conv").i ? P->Gamma : P->alpha; + P->sinrot = sin(f); + P->cosrot = cos(f); + P->u_0 = pj_param(P->params, "bno_uoff").i ? 0. : + fabs(P->al * atan(sqrt(d * d - 1.) / P->cosrot) / P->bl); + if (P->phi0 < 0.) + P->u_0 = - P->u_0; + P->inv = e_inverse; + P->fwd = e_forward; +ENDENTRY(P) diff --git a/src/PJ_ortho.c b/src/PJ_ortho.c new file mode 100644 index 00000000..98abf731 --- /dev/null +++ b/src/PJ_ortho.c @@ -0,0 +1,92 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_ortho.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double sinph0; \ + double cosph0; \ + int mode; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(ortho, "Orthographic") "\n\tAzi, Sph."; +#define EPS10 1.e-10 +#define N_POLE 0 +#define S_POLE 1 +#define EQUIT 2 +#define OBLIQ 3 +FORWARD(s_forward); /* spheroid */ + double coslam, cosphi, sinphi; + + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + switch (P->mode) { + case EQUIT: + if (cosphi * coslam < - EPS10) F_ERROR; + xy.y = sin(lp.phi); + break; + case OBLIQ: + if (P->sinph0 * (sinphi = sin(lp.phi)) + + P->cosph0 * cosphi * coslam < - EPS10) F_ERROR; + xy.y = P->cosph0 * sinphi - P->sinph0 * cosphi * coslam; + break; + case N_POLE: + coslam = - coslam; + case S_POLE: + if (fabs(lp.phi - P->phi0) - EPS10 > HALFPI) F_ERROR; + xy.y = cosphi * coslam; + break; + } + xy.x = cosphi * sin(lp.lam); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double rh, cosc, sinc; + + if ((sinc = (rh = hypot(xy.x, xy.y))) > 1.) { + if ((sinc - 1.) > EPS10) I_ERROR; + sinc = 1.; + } + cosc = sqrt(1. - sinc * sinc); /* in this range OK */ + if (fabs(rh) <= EPS10) + lp.phi = P->phi0; + else switch (P->mode) { + case N_POLE: + xy.y = -xy.y; + lp.phi = acos(sinc); + break; + case S_POLE: + lp.phi = - acos(sinc); + break; + case EQUIT: + lp.phi = xy.y * sinc / rh; + xy.x *= sinc; + xy.y = cosc * rh; + goto sinchk; + case OBLIQ: + lp.phi = cosc * P->sinph0 + xy.y * sinc * P->cosph0 / rh; + xy.y = (cosc - P->sinph0 * lp.phi) * rh; + xy.x *= sinc * P->cosph0; +sinchk: + if (fabs(lp.phi) >= 1.) + lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + else + lp.phi = asin(lp.phi); + break; + } + lp.lam = (xy.y == 0. && (P->mode == OBLIQ || P->mode == EQUIT)) ? + (xy.x == 0. ? 0. : xy.x < 0. ? -HALFPI : HALFPI) : atan2(xy.x, xy.y); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(ortho) + if (fabs(fabs(P->phi0) - HALFPI) <= EPS10) + P->mode = P->phi0 < 0. ? S_POLE : N_POLE; + else if (fabs(P->phi0) > EPS10) { + P->mode = OBLIQ; + P->sinph0 = sin(P->phi0); + P->cosph0 = cos(P->phi0); + } else + P->mode = EQUIT; + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_poly.c b/src/PJ_poly.c new file mode 100644 index 00000000..04d8cd96 --- /dev/null +++ b/src/PJ_poly.c @@ -0,0 +1,102 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_poly.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double ml0; \ + double *en; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(poly, "Polyconic (American)") + "\n\tConic, Sph&Ell"; +#define TOL 1e-10 +#define CONV 1e-10 +#define N_ITER 10 +#define I_ITER 20 +#define ITOL 1.e-12 +FORWARD(e_forward); /* ellipsoid */ + double ms, sp, cp; + + if (fabs(lp.phi) <= TOL) { xy.x = lp.lam; xy.y = -P->ml0; } + else { + sp = sin(lp.phi); + ms = fabs(cp = cos(lp.phi)) > TOL ? pj_msfn(sp, cp, P->es) / sp : 0.; + xy.x = ms * sin(lp.lam *= sp); + xy.y = (pj_mlfn(lp.phi, sp, cp, P->en) - P->ml0) + ms * (1. - cos(lp.lam)); + } + return (xy); +} +FORWARD(s_forward); /* spheroid */ + double cot, E; + + if (fabs(lp.phi) <= TOL) { xy.x = lp.lam; xy.y = P->ml0; } + else { + cot = 1. / tan(lp.phi); + xy.x = sin(E = lp.lam * sin(lp.phi)) * cot; + xy.y = lp.phi - P->phi0 + cot * (1. - cos(E)); + } + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + xy.y += P->ml0; + if (fabs(xy.y) <= TOL) { lp.lam = xy.x; lp.phi = 0.; } + else { + double r, c, sp, cp, s2ph, ml, mlb, mlp, dPhi; + int i; + + r = xy.y * xy.y + xy.x * xy.x; + for (lp.phi = xy.y, i = I_ITER; i ; --i) { + sp = sin(lp.phi); + s2ph = sp * ( cp = cos(lp.phi)); + if (fabs(cp) < ITOL) + I_ERROR; + c = sp * (mlp = sqrt(1. - P->es * sp * sp)) / cp; + ml = pj_mlfn(lp.phi, sp, cp, P->en); + mlb = ml * ml + r; + mlp = P->one_es / (mlp * mlp * mlp); + lp.phi += ( dPhi = + ( ml + ml + c * mlb - 2. * xy.y * (c * ml + 1.) ) / ( + P->es * s2ph * (mlb - 2. * xy.y * ml) / c + + 2.* (xy.y - ml) * (c * mlp - 1. / s2ph) - mlp - mlp )); + if (fabs(dPhi) <= ITOL) + break; + } + if (!i) + I_ERROR; + c = sin(lp.phi); + lp.lam = asin(xy.x * tan(lp.phi) * sqrt(1. - P->es * c * c)) / sin(lp.phi); + } + return (lp); +} +INVERSE(s_inverse); /* spheroid */ + double B, dphi, tp; + int i; + + if (fabs(xy.y = P->phi0 + xy.y) <= TOL) { lp.lam = xy.x; lp.phi = 0.; } + else { + lp.phi = xy.y; + B = xy.x * xy.x + xy.y * xy.y; + i = N_ITER; + do { + tp = tan(lp.phi); + lp.phi -= (dphi = (xy.y * (lp.phi * tp + 1.) - lp.phi - + .5 * ( lp.phi * lp.phi + B) * tp) / + ((lp.phi - xy.y) / tp - 1.)); + } while (fabs(dphi) > CONV && --i); + if (! i) I_ERROR; + lp.lam = asin(xy.x * tan(lp.phi)) / sin(lp.phi); + } + return (lp); +} +FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } +ENTRY1(poly, en) + if (P->es) { + if (!(P->en = pj_enfn(P->es))) E_ERROR_0; + P->ml0 = pj_mlfn(P->phi0, sin(P->phi0), cos(P->phi0), P->en); + P->inv = e_inverse; + P->fwd = e_forward; + } else { + P->ml0 = -P->phi0; + P->inv = s_inverse; + P->fwd = s_forward; + } +ENDENTRY(P) diff --git a/src/PJ_putp2.c b/src/PJ_putp2.c new file mode 100644 index 00000000..89ec6720 --- /dev/null +++ b/src/PJ_putp2.c @@ -0,0 +1,43 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_putp2.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(putp2, "Putnins P2") "\n\tPCyl., Sph."; +#define C_x 1.89490 +#define C_y 1.71848 +#define C_p 0.6141848493043784 +#define EPS 1e-10 +#define NITER 10 +#define PI_DIV_3 1.0471975511965977 +FORWARD(s_forward); /* spheroid */ + double p, c, s, V; + int i; + + p = C_p * sin(lp.phi); + s = lp.phi * lp.phi; + lp.phi *= 0.615709 + s * ( 0.00909953 + s * 0.0046292 ); + for (i = NITER; i ; --i) { + c = cos(lp.phi); + s = sin(lp.phi); + lp.phi -= V = (lp.phi + s * (c - 1.) - p) / + (1. + c * (c - 1.) - s * s); + if (fabs(V) < EPS) + break; + } + if (!i) + lp.phi = lp.phi < 0 ? - PI_DIV_3 : PI_DIV_3; + xy.x = C_x * lp.lam * (cos(lp.phi) - 0.5); + xy.y = C_y * sin(lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double c; + + lp.phi = aasin(xy.y / C_y); + lp.lam = xy.x / (C_x * ((c = cos(lp.phi)) - 0.5)); + lp.phi = aasin((lp.phi + sin(lp.phi) * (c - 1.)) / C_p); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(putp2) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_putp3.c b/src/PJ_putp3.c new file mode 100644 index 00000000..c228423c --- /dev/null +++ b/src/PJ_putp3.c @@ -0,0 +1,29 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_putp3.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double A; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(putp3, "Putnins P3") "\n\tPCyl., Sph."; +PROJ_HEAD(putp3p, "Putnins P3'") "\n\tPCyl., no inv., Sph."; +#define C 0.79788456 +#define RPISQ 0.1013211836 +FORWARD(s_forward); /* spheroid */ + xy.x = C * lp.lam * (1. - P->A * lp.phi * lp.phi); + xy.y = C * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / C; + lp.lam = xy.x / (C * (1. - P->A * lp.phi * lp.phi)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; + return P; +} +ENTRY0(putp3) P->A = 4. * RPISQ; ENDENTRY(setup(P)) +ENTRY0(putp3p) P->A = 2. * RPISQ; ENDENTRY(setup(P)) diff --git a/src/PJ_putp4p.c b/src/PJ_putp4p.c new file mode 100644 index 00000000..1d07350f --- /dev/null +++ b/src/PJ_putp4p.c @@ -0,0 +1,32 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_putp4p.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double C_x, C_y; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(putp4p, "Putnins P4'") "\n\tPCyl., Sph."; +PROJ_HEAD(weren, "Werenskiold I") "\n\tPCyl., Sph."; +FORWARD(s_forward); /* spheroid */ + lp.phi = aasin(0.883883476 * sin(lp.phi)); + xy.x = P->C_x * lp.lam * cos(lp.phi); + xy.x /= cos(lp.phi *= 0.333333333333333); + xy.y = P->C_y * sin(lp.phi); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = aasin(xy.y / P->C_y); + lp.lam = xy.x * cos(lp.phi) / P->C_x; + lp.phi *= 3.; + lp.lam /= cos(lp.phi); + lp.phi = aasin(1.13137085 * sin(lp.phi)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; + return P; +} +ENTRY0(putp4p) P->C_x = 0.874038744; P->C_y = 3.883251825; ENDENTRY(setup(P)) +ENTRY0(weren) P->C_x = 1.; P->C_y = 4.442882938; ENDENTRY(setup(P)) diff --git a/src/PJ_putp5.c b/src/PJ_putp5.c new file mode 100644 index 00000000..7e20012a --- /dev/null +++ b/src/PJ_putp5.c @@ -0,0 +1,29 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_putp5.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double A, B; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(putp5, "Putnins P5") "\n\tPCyl., Sph."; +PROJ_HEAD(putp5p, "Putnins P5'") "\n\tPCyl., Sph."; +#define C 1.01346 +#define D 1.2158542 +FORWARD(s_forward); /* spheroid */ + xy.x = C * lp.lam * (P->A - P->B * sqrt(1. + D * lp.phi * lp.phi)); + xy.y = C * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / C; + lp.lam = xy.x / (C * (P->A - P->B * sqrt(1. + D * lp.phi * lp.phi))); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; + return P; +} +ENTRY0(putp5) P->A = 2.; P->B = 1.; ENDENTRY(setup(P)) +ENTRY0(putp5p) P->A = 1.5; P->B = 0.5; ENDENTRY(setup(P)) diff --git a/src/PJ_putp6.c b/src/PJ_putp6.c new file mode 100644 index 00000000..ae3e68b4 --- /dev/null +++ b/src/PJ_putp6.c @@ -0,0 +1,62 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_putp6.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double C_x, C_y, A, B, D; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(putp6, "Putnins P6") "\n\tPCyl., Sph."; +PROJ_HEAD(putp6p, "Putnins P6'") "\n\tPCyl., Sph."; +#define EPS 1e-10 +#define NITER 10 +#define CON_POLE 1.732050807568877 +FORWARD(s_forward); /* spheroid */ + double p, r, V; + int i; + + p = P->B * sin(lp.phi); + lp.phi *= 1.10265779; + for (i = NITER; i ; --i) { + r = sqrt(1. + lp.phi * lp.phi); + lp.phi -= V = ( (P->A - r) * lp.phi - log(lp.phi + r) - p ) / + (P->A - 2. * r); + if (fabs(V) < EPS) + break; + } + if (!i) + lp.phi = p < 0. ? -CON_POLE : CON_POLE; + xy.x = P->C_x * lp.lam * (P->D - sqrt(1. + lp.phi * lp.phi)); + xy.y = P->C_y * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double r; + + lp.phi = xy.y / P->C_y; + r = sqrt(1. + lp.phi * lp.phi); + lp.lam = xy.x / (P->C_x * (P->D - r)); + lp.phi = aasin( ( (P->A - r) * lp.phi - log(lp.phi + r) ) / P->B); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->es = 0.; + P->inv = s_inverse; + P->fwd = s_forward; + return P; +} +ENTRY0(putp6) + P->C_x = 1.01346; + P->C_y = 0.91910; + P->A = 4.; + P->B = 2.1471437182129378784; + P->D = 2.; +ENDENTRY(setup(P)) +ENTRY0(putp6p) + P->C_x = 0.44329; + P->C_y = 0.80404; + P->A = 6.; + P->B = 5.61125; + P->D = 3.; +ENDENTRY(setup(P)) diff --git a/src/PJ_robin.c b/src/PJ_robin.c new file mode 100644 index 00000000..526796ff --- /dev/null +++ b/src/PJ_robin.c @@ -0,0 +1,108 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_robin.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(robin, "Robinson") "\n\tPCyl., Sph."; +#define V(C,z) (C.c0 + z * (C.c1 + z * (C.c2 + z * C.c3))) +#define DV(C,z) (C.c1 + z * (C.c2 + C.c2 + z * 3. * C.c3)) +/* note: following terms based upon 5 deg. intervals in degrees. */ +static struct COEFS { + float c0, c1, c2, c3; +} X[] = { +1, -5.67239e-12, -7.15511e-05, 3.11028e-06, +0.9986, -0.000482241, -2.4897e-05, -1.33094e-06, +0.9954, -0.000831031, -4.4861e-05, -9.86588e-07, +0.99, -0.00135363, -5.96598e-05, 3.67749e-06, +0.9822, -0.00167442, -4.4975e-06, -5.72394e-06, +0.973, -0.00214869, -9.03565e-05, 1.88767e-08, +0.96, -0.00305084, -9.00732e-05, 1.64869e-06, +0.9427, -0.00382792, -6.53428e-05, -2.61493e-06, +0.9216, -0.00467747, -0.000104566, 4.8122e-06, +0.8962, -0.00536222, -3.23834e-05, -5.43445e-06, +0.8679, -0.00609364, -0.0001139, 3.32521e-06, +0.835, -0.00698325, -6.40219e-05, 9.34582e-07, +0.7986, -0.00755337, -5.00038e-05, 9.35532e-07, +0.7597, -0.00798325, -3.59716e-05, -2.27604e-06, +0.7186, -0.00851366, -7.0112e-05, -8.63072e-06, +0.6732, -0.00986209, -0.000199572, 1.91978e-05, +0.6213, -0.010418, 8.83948e-05, 6.24031e-06, +0.5722, -0.00906601, 0.000181999, 6.24033e-06, +0.5322, 0.,0.,0. }, +Y[] = { +0, 0.0124, 3.72529e-10, 1.15484e-09, +0.062, 0.0124001, 1.76951e-08, -5.92321e-09, +0.124, 0.0123998, -7.09668e-08, 2.25753e-08, +0.186, 0.0124008, 2.66917e-07, -8.44523e-08, +0.248, 0.0123971, -9.99682e-07, 3.15569e-07, +0.31, 0.0124108, 3.73349e-06, -1.1779e-06, +0.372, 0.0123598, -1.3935e-05, 4.39588e-06, +0.434, 0.0125501, 5.20034e-05, -1.00051e-05, +0.4968, 0.0123198, -9.80735e-05, 9.22397e-06, +0.5571, 0.0120308, 4.02857e-05, -5.2901e-06, +0.6176, 0.0120369, -3.90662e-05, 7.36117e-07, +0.6769, 0.0117015, -2.80246e-05, -8.54283e-07, +0.7346, 0.0113572, -4.08389e-05, -5.18524e-07, +0.7903, 0.0109099, -4.86169e-05, -1.0718e-06, +0.8435, 0.0103433, -6.46934e-05, 5.36384e-09, +0.8936, 0.00969679, -6.46129e-05, -8.54894e-06, +0.9394, 0.00840949, -0.000192847, -4.21023e-06, +0.9761, 0.00616525, -0.000256001, -4.21021e-06, +1., 0.,0.,0 }; +#define FXC 0.8487 +#define FYC 1.3523 +#define C1 11.45915590261646417544 +#define RC1 0.08726646259971647884 +#define NODES 18 +#define ONEEPS 1.000001 +#define EPS 1e-8 +FORWARD(s_forward); /* spheroid */ + int i; + double dphi; + + i = floor((dphi = fabs(lp.phi)) * C1); + if (i >= NODES) i = NODES - 1; + dphi = RAD_TO_DEG * (dphi - RC1 * i); + xy.x = V(X[i], dphi) * FXC * lp.lam; + xy.y = V(Y[i], dphi) * FYC; + if (lp.phi < 0.) xy.y = -xy.y; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + int i; + double t, t1; + struct COEFS T; + + lp.lam = xy.x / FXC; + lp.phi = fabs(xy.y / FYC); + if (lp.phi >= 1.) { /* simple pathologic cases */ + if (lp.phi > ONEEPS) I_ERROR + else { + lp.phi = xy.y < 0. ? -HALFPI : HALFPI; + lp.lam /= X[NODES].c0; + } + } else { /* general problem */ + /* in Y space, reduce to table interval */ + for (i = floor(lp.phi * NODES);;) { + if (Y[i].c0 > lp.phi) --i; + else if (Y[i+1].c0 <= lp.phi) ++i; + else break; + } + T = Y[i]; + /* first guess, linear interp */ + t = 5. * (lp.phi - T.c0)/(Y[i+1].c0 - T.c0); + /* make into root */ + T.c0 -= lp.phi; + for (;;) { /* Newton-Raphson reduction */ + t -= t1 = V(T,t) / DV(T,t); + if (fabs(t1) < EPS) + break; + } + lp.phi = (5 * i + t) * DEG_TO_RAD; + if (xy.y < 0.) lp.phi = -lp.phi; + lp.lam /= V(X[i], t); + } + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(robin) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_rpoly.c b/src/PJ_rpoly.c new file mode 100644 index 00000000..7873b8c0 --- /dev/null +++ b/src/PJ_rpoly.c @@ -0,0 +1,38 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_rpoly.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double phi1; \ + double fxa; \ + double fxb; \ + int mode; +#define EPS 1e-9 +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(rpoly, "Rectangular Polyconic") + "\n\tConic, Sph., no inv.\n\tlat_ts="; +FORWARD(s_forward); /* spheroid */ + double fa; + + if (P->mode) + fa = tan(lp.lam * P->fxb) * P->fxa; + else + fa = 0.5 * lp.lam; + if (fabs(lp.phi) < EPS) { + xy.x = fa + fa; + xy.y = - P->phi0; + } else { + xy.y = 1. / tan(lp.phi); + xy.x = sin(fa = 2. * atan(fa * sin(lp.phi))) * xy.y; + xy.y = lp.phi - P->phi0 + (1. - cos(fa)) * xy.y; + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(rpoly) + if ((P->mode = (P->phi1 = fabs(pj_param(P->params, "rlat_ts").f)) > EPS)) { + P->fxb = 0.5 * sin(P->phi1); + P->fxa = 0.5 / P->fxb; + } + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_sconics.c b/src/PJ_sconics.c new file mode 100644 index 00000000..567e4f60 --- /dev/null +++ b/src/PJ_sconics.c @@ -0,0 +1,157 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_sconics.c 4.1 94/05/22 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double n; \ + double rho_c; \ + double rho_0; \ + double sig; \ + double c1, c2; \ + int type; +#define PJ_LIB__ +#include <projects.h> +#define EULER 0 +#define MURD1 1 +#define MURD2 2 +#define MURD3 3 +#define PCONIC 4 +#define TISSOT 5 +#define VITK1 6 +#define EPS10 1.e-10 +#define EPS 1e-10 +#define LINE2 "\n\tConic, Sph\n\tlat_1= and lat_2=" +PROJ_HEAD(tissot, "Tissot") + LINE2; +PROJ_HEAD(murd1, "Murdoch I") + LINE2; +PROJ_HEAD(murd2, "Murdoch II") + LINE2; +PROJ_HEAD(murd3, "Murdoch III") + LINE2; +PROJ_HEAD(euler, "Euler") + LINE2; +PROJ_HEAD(pconic, "Perspective Conic") + LINE2; +PROJ_HEAD(vitk1, "Vitkovsky I") + LINE2; +/* get common factors for simple conics */ + static int +phi12(PJ *P, double *del) { + double p1, p2, d, s; + int err = 0; + + if (!pj_param(P->params, "tlat_1").i || + !pj_param(P->params, "tlat_2").i) { + err = -41; + } else { + p1 = pj_param(P->params, "rlat_1").f; + p2 = pj_param(P->params, "rlat_2").f; + *del = 0.5 * (p2 - p1); + P->sig = 0.5 * (p2 + p1); + err = (fabs(*del) < EPS || fabs(P->sig) < EPS) ? -42 : 0; + *del = *del; + } + return err; +} +FORWARD(s_forward); /* spheroid */ + double rho; + + switch (P->type) { + case MURD2: + rho = P->rho_c + tan(P->sig - lp.phi); + break; + case PCONIC: + rho = P->c2 * (P->c1 - tan(lp.phi)); + break; + default: + rho = P->rho_c - lp.phi; + break; + } + xy.x = rho * sin( lp.lam *= P->n ); + xy.y = P->rho_0 - rho * cos(lp.lam); + return (xy); +} +INVERSE(s_inverse); /* ellipsoid & spheroid */ + double rho; + + rho = hypot(xy.x, xy.y = P->rho_0 - xy.y); + if (P->n < 0.) { + rho = - rho; + xy.x = - xy.x; + xy.y = - xy.y; + } + lp.lam = atan2(xy.x, xy.y) / P->n; + switch (P->type) { + case PCONIC: + lp.phi = atan(P->c1 - rho / P->c2) + P->sig; + break; + case MURD2: + lp.phi = P->sig - atan(rho - P->rho_c); + break; + default: + lp.phi = P->rho_c - rho; + } + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + double del, cs, dummy; + int i; + + if (i = phi12(P, &del)) + E_ERROR(i); + switch (P->type) { + case TISSOT: + P->n = sin(P->sig); + cs = cos(del); + P->rho_c = P->n / cs + cs / P->n; + P->rho_0 = sqrt((P->rho_c - 2 * sin(P->phi0))/P->n); + break; + case MURD1: + P->rho_c = sin(del)/(del * tan(P->sig)) + P->sig; + P->rho_0 = P->rho_c - P->phi0; + P->n = sin(P->sig); + break; + case MURD2: + P->rho_c = (cs = sqrt(cos(del))) / tan(P->sig); + P->rho_0 = P->rho_c + tan(P->sig - P->phi0); + P->n = sin(P->sig) * cs; + break; + case MURD3: + P->rho_c = del / (tan(P->sig) * tan(del)) + P->sig; + P->rho_0 = P->rho_c - P->phi0; + P->n = sin(P->sig) * sin(del) * tan(del) / (del * del); + break; + case EULER: + P->n = sin(P->sig) * sin(del) / del; + del *= 0.5; + P->rho_c = del / (tan(del) * tan(P->sig)) + P->sig; + P->rho_0 = P->rho_c - P->phi0; + break; + case PCONIC: + P->n = sin(P->sig); + P->c2 = cos(del); + P->c1 = 1./tan(P->sig); + if (fabs(del = P->phi0 - P->sig) - EPS10 >= HALFPI) + E_ERROR(-43); + P->rho_0 = P->c2 * (P->c1 - tan(del)); + break; + case VITK1: + P->n = (cs = tan(del)) * sin(P->sig) / del; + P->rho_c = del / (cs * tan(P->sig)) + P->sig; + P->rho_0 = P->rho_c - P->phi0; + break; + } + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0; + return (P); +} +ENTRY0(euler) P->type = EULER; ENDENTRY(setup(P)) +ENTRY0(tissot) P->type = TISSOT; ENDENTRY(setup(P)) +ENTRY0(murd1) P->type = MURD1; ENDENTRY(setup(P)) +ENTRY0(murd2) P->type = MURD2; ENDENTRY(setup(P)) +ENTRY0(murd3) P->type = MURD3; ENDENTRY(setup(P)) +ENTRY0(pconic) P->type = PCONIC; ENDENTRY(setup(P)) +ENTRY0(vitk1) P->type = VITK1; ENDENTRY(setup(P)) diff --git a/src/PJ_somerc.c b/src/PJ_somerc.c new file mode 100644 index 00000000..4be9f085 --- /dev/null +++ b/src/PJ_somerc.c @@ -0,0 +1,69 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_somerc.c 4.1 95/08/09 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double K, c, hlf_e, kR, cosp0, sinp0; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(somerc, "Swiss. Obl. Mercator") "\n\tCyl, Ell\n\tFor CH1903"; +#define EPS 1.e-10 +#define NITER 6 +FORWARD(e_forward); + double phip, lamp, phipp, lampp, sp, cp; + + sp = P->e * sin(lp.phi); + phip = 2.* atan( exp( P->c * ( + log(tan(FORTPI + 0.5 * lp.phi)) - P->hlf_e * log((1. + sp)/(1. - sp))) + + P->K)) - HALFPI; + lamp = P->c * lp.lam; + cp = cos(phip); + phipp = aasin(P->cosp0 * sin(phip) - P->sinp0 * cp * cos(lamp)); + lampp = aasin(cp * sin(lamp) / cos(phipp)); + xy.x = P->kR * lampp; + xy.y = P->kR * log(tan(FORTPI + 0.5 * phipp)); + return (xy); +} +INVERSE(e_inverse); /* ellipsoid & spheroid */ + double phip, lamp, phipp, lampp, cp, esp, con, delp; + int i; + + phipp = 2. * (atan(exp(xy.y / P->kR)) - FORTPI); + lampp = xy.x / P->kR; + cp = cos(phipp); + phip = aasin(P->cosp0 * sin(phipp) + P->sinp0 * cp * cos(lampp)); + lamp = aasin(cp * sin(lampp) / cos(phip)); + con = (P->K - log(tan(FORTPI + 0.5 * phip)))/P->c; + for (i = NITER; i ; --i) { + esp = P->e * sin(phip); + delp = (con + log(tan(FORTPI + 0.5 * phip)) - P->hlf_e * + log((1. + esp)/(1. - esp)) ) * + (1. - esp * esp) * cos(phip) * P->rone_es; + phip -= delp; + if (fabs(delp) < EPS) + break; + } + if (i) { + lp.phi = phip; + lp.lam = lamp / P->c; + } else + I_ERROR + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(somerc) + double cp, phip0, sp; + + P->hlf_e = 0.5 * P->e; + cp = cos(P->phi0); + cp *= cp; + P->c = sqrt(1 + P->es * cp * cp * P->rone_es); + sp = sin(P->phi0); + P->cosp0 = cos( phip0 = aasin(P->sinp0 = sp / P->c) ); + sp *= P->e; + P->K = log(tan(FORTPI + 0.5 * phip0)) - P->c * ( + log(tan(FORTPI + 0.5 * P->phi0)) - P->hlf_e * + log((1. + sp) / (1. - sp))); + P->kR = P->k0 * sqrt(P->one_es) / (1. - sp * sp); + P->inv = e_inverse; + P->fwd = e_forward; +ENDENTRY(P) diff --git a/src/PJ_stere.c b/src/PJ_stere.c new file mode 100644 index 00000000..5c130420 --- /dev/null +++ b/src/PJ_stere.c @@ -0,0 +1,244 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_stere.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double phits; \ + double sinX1; \ + double cosX1; \ + double akm1; \ + int mode; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(stere, "Stereographic") "\n\tAzi, Sph&Ell\n\tlat_ts="; +PROJ_HEAD(ups, "Universal Polar Stereographic") "\n\tAzi, Sph&Ell\n\tsouth"; +#define sinph0 P->sinX1 +#define cosph0 P->cosX1 +#define EPS10 1.e-10 +#define TOL 1.e-8 +#define NITER 8 +#define CONV 1.e-10 +#define S_POLE 0 +#define N_POLE 1 +#define OBLIQ 2 +#define EQUIT 3 + static double +ssfn_(double phit, double sinphi, double eccen) { + sinphi *= eccen; + return (tan (.5 * (HALFPI + phit)) * + pow((1. - sinphi) / (1. + sinphi), .5 * eccen)); +} +FORWARD(e_forward); /* ellipsoid */ + double coslam, sinlam, sinX, cosX, X, A, sinphi; + + coslam = cos(lp.lam); + sinlam = sin(lp.lam); + sinphi = sin(lp.phi); + if (P->mode == OBLIQ || P->mode == EQUIT) { + sinX = sin(X = 2. * atan(ssfn_(lp.phi, sinphi, P->e)) - HALFPI); + cosX = cos(X); + } + switch (P->mode) { + case OBLIQ: + A = P->akm1 / (P->cosX1 * (1. + P->sinX1 * sinX + + P->cosX1 * cosX * coslam)); + xy.y = A * (P->cosX1 * sinX - P->sinX1 * cosX * coslam); + goto xmul; + case EQUIT: + A = 2. * P->akm1 / (1. + cosX * coslam); + xy.y = A * sinX; +xmul: + xy.x = A * cosX; + break; + case S_POLE: + lp.phi = -lp.phi; + coslam = - coslam; + sinphi = -sinphi; + case N_POLE: + xy.x = P->akm1 * pj_tsfn(lp.phi, sinphi, P->e); + xy.y = - xy.x * coslam; + break; + } + xy.x = xy.x * sinlam; + return (xy); +} +FORWARD(s_forward); /* spheroid */ + double sinphi, cosphi, coslam, sinlam; + + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + coslam = cos(lp.lam); + sinlam = sin(lp.lam); + switch (P->mode) { + case EQUIT: + xy.y = 1. + cosphi * coslam; + goto oblcon; + case OBLIQ: + xy.y = 1. + sinph0 * sinphi + cosph0 * cosphi * coslam; +oblcon: + if (xy.y <= EPS10) F_ERROR; + xy.x = (xy.y = P->akm1 / xy.y) * cosphi * sinlam; + xy.y *= (P->mode == EQUIT) ? sinphi : + cosph0 * sinphi - sinph0 * cosphi * coslam; + break; + case N_POLE: + coslam = - coslam; + lp.phi = - lp.phi; + case S_POLE: + if (fabs(lp.phi - HALFPI) < TOL) F_ERROR; + xy.x = sinlam * ( xy.y = P->akm1 * tan(FORTPI + .5 * lp.phi) ); + xy.y *= coslam; + break; + } + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + double cosphi, sinphi, tp, phi_l, rho, halfe, halfpi; + int i; + + rho = hypot(xy.x, xy.y); + switch (P->mode) { + case OBLIQ: + case EQUIT: + cosphi = cos( tp = 2. * atan2(rho * P->cosX1 , P->akm1) ); + sinphi = sin(tp); + if( rho == 0.0 ) + phi_l = asin(cosphi * P->sinX1); + else + phi_l = asin(cosphi * P->sinX1 + (xy.y * sinphi * P->cosX1 / rho)); + + tp = tan(.5 * (HALFPI + phi_l)); + xy.x *= sinphi; + xy.y = rho * P->cosX1 * cosphi - xy.y * P->sinX1* sinphi; + halfpi = HALFPI; + halfe = .5 * P->e; + break; + case N_POLE: + xy.y = -xy.y; + case S_POLE: + phi_l = HALFPI - 2. * atan(tp = - rho / P->akm1); + halfpi = -HALFPI; + halfe = -.5 * P->e; + break; + } + for (i = NITER; i--; phi_l = lp.phi) { + sinphi = P->e * sin(phi_l); + lp.phi = 2. * atan(tp * pow((1.+sinphi)/(1.-sinphi), + halfe)) - halfpi; + if (fabs(phi_l - lp.phi) < CONV) { + if (P->mode == S_POLE) + lp.phi = -lp.phi; + lp.lam = (xy.x == 0. && xy.y == 0.) ? 0. : atan2(xy.x, xy.y); + return (lp); + } + } + I_ERROR; +} +INVERSE(s_inverse); /* spheroid */ + double c, rh, sinc, cosc; + + sinc = sin(c = 2. * atan((rh = hypot(xy.x, xy.y)) / P->akm1)); + cosc = cos(c); + lp.lam = 0.; + switch (P->mode) { + case EQUIT: + if (fabs(rh) <= EPS10) + lp.phi = 0.; + else + lp.phi = asin(xy.y * sinc / rh); + if (cosc != 0. || xy.x != 0.) + lp.lam = atan2(xy.x * sinc, cosc * rh); + break; + case OBLIQ: + if (fabs(rh) <= EPS10) + lp.phi = P->phi0; + else + lp.phi = asin(cosc * sinph0 + xy.y * sinc * cosph0 / rh); + if ((c = cosc - sinph0 * sin(lp.phi)) != 0. || xy.x != 0.) + lp.lam = atan2(xy.x * sinc * cosph0, c * rh); + break; + case N_POLE: + xy.y = -xy.y; + case S_POLE: + if (fabs(rh) <= EPS10) + lp.phi = P->phi0; + else + lp.phi = asin(P->mode == S_POLE ? - cosc : cosc); + lp.lam = (xy.x == 0. && xy.y == 0.) ? 0. : atan2(xy.x, xy.y); + break; + } + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { /* general initialization */ + double t; + + if (fabs((t = fabs(P->phi0)) - HALFPI) < EPS10) + P->mode = P->phi0 < 0. ? S_POLE : N_POLE; + else + P->mode = t > EPS10 ? OBLIQ : EQUIT; + P->phits = fabs(P->phits); + if (P->es) { + double X; + + switch (P->mode) { + case N_POLE: + case S_POLE: + if (fabs(P->phits - HALFPI) < EPS10) + P->akm1 = 2. * P->k0 / + sqrt(pow(1+P->e,1+P->e)*pow(1-P->e,1-P->e)); + else { + P->akm1 = cos(P->phits) / + pj_tsfn(P->phits, t = sin(P->phits), P->e); + t *= P->e; + P->akm1 /= sqrt(1. - t * t); + } + break; + case EQUIT: + P->akm1 = 2. * P->k0; + break; + case OBLIQ: + t = sin(P->phi0); + X = 2. * atan(ssfn_(P->phi0, t, P->e)) - HALFPI; + t *= P->e; + P->akm1 = 2. * P->k0 * cos(P->phi0) / sqrt(1. - t * t); + P->sinX1 = sin(X); + P->cosX1 = cos(X); + break; + } + P->inv = e_inverse; + P->fwd = e_forward; + } else { + switch (P->mode) { + case OBLIQ: + sinph0 = sin(P->phi0); + cosph0 = cos(P->phi0); + case EQUIT: + P->akm1 = 2. * P->k0; + break; + case S_POLE: + case N_POLE: + P->akm1 = fabs(P->phits - HALFPI) >= EPS10 ? + cos(P->phits) / tan(FORTPI - .5 * P->phits) : + 2. * P->k0 ; + break; + } + P->inv = s_inverse; + P->fwd = s_forward; + } + return P; +} +ENTRY0(stere) + P->phits = pj_param(P->params, "tlat_ts").i ? + P->phits = pj_param(P->params, "rlat_ts").f : HALFPI; +ENDENTRY(setup(P)) +ENTRY0(ups) + /* International Ellipsoid */ + P->phi0 = pj_param(P->params, "bsouth").i ? - HALFPI: HALFPI; + if (!P->es) E_ERROR(-34); + P->k0 = .994; + P->x0 = 2000000.; + P->y0 = 2000000.; + P->phits = HALFPI; + P->lam0 = 0.; +ENDENTRY(setup(P)) diff --git a/src/PJ_sts.c b/src/PJ_sts.c new file mode 100644 index 00000000..e3caca75 --- /dev/null +++ b/src/PJ_sts.c @@ -0,0 +1,57 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_sts.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double C_x, C_y, C_p; \ + int tan_mode; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(kav5, "Kavraisky V") "\n\tPCyl., Sph."; +PROJ_HEAD(qua_aut, "Quartic Authalic") "\n\tPCyl., Sph."; +PROJ_HEAD(mbt_s, "McBryde-Thomas Flat-Polar Sine (No. 1)") "\n\tPCyl., Sph."; +PROJ_HEAD(fouc, "Foucaut") "\n\tPCyl., Sph."; +FORWARD(s_forward); /* spheroid */ + double c; + + xy.x = P->C_x * lp.lam * cos(lp.phi); + xy.y = P->C_y; + lp.phi *= P->C_p; + c = cos(lp.phi); + if (P->tan_mode) { + xy.x *= c * c; + xy.y *= tan(lp.phi); + } else { + xy.x /= c; + xy.y *= sin(lp.phi); + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double c; + + xy.y /= P->C_y; + c = cos(lp.phi = P->tan_mode ? atan(xy.y) : aasin(xy.y)); + lp.phi /= P->C_p; + lp.lam = xy.x / (P->C_x * cos(lp.phi /= P->C_p)); + if (P->tan_mode) + lp.lam /= c * c; + else + lp.lam *= c; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P, double p, double q, int mode) { + P->es = 0.; + P->inv = s_inverse; + P->fwd = s_forward; + P->C_x = q / p; + P->C_y = p; + P->C_p = 1/ q; + P->tan_mode = mode; + return P; +} +ENTRY0(kav5) ENDENTRY(setup(P, 1.50488, 1.35439, 0)) +ENTRY0(qua_aut) ENDENTRY(setup(P, 2., 2., 0)) +ENTRY0(mbt_s) ENDENTRY(setup(P, 1.48875, 1.36509, 0)) +ENTRY0(fouc) ENDENTRY(setup(P, 2., 2., 1)) diff --git a/src/PJ_tcc.c b/src/PJ_tcc.c new file mode 100644 index 00000000..feb2d4e9 --- /dev/null +++ b/src/PJ_tcc.c @@ -0,0 +1,20 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_tcc.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double ap; +#define EPS10 1.e-10 +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(tcc, "Transverse Central Cylindrical") "\n\tCyl, Sph, no inv."; +FORWARD(s_forward); /* spheroid */ + double b, bt; + + b = cos(lp.phi) * sin(lp.lam); + if ((bt = 1. - b * b) < EPS10) F_ERROR; + xy.x = b / sqrt(bt); + xy.y = atan2(tan(lp.phi) , cos(lp.lam)); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(tcc) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_tcea.c b/src/PJ_tcea.c new file mode 100644 index 00000000..caa8ab61 --- /dev/null +++ b/src/PJ_tcea.c @@ -0,0 +1,30 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_tcea.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double rk0; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") "\n\tCyl, Sph"; +FORWARD(s_forward); /* spheroid */ + xy.x = P->rk0 * cos(lp.phi) * sin(lp.lam); + xy.y = P->k0 * (atan2(tan(lp.phi), cos(lp.lam)) - P->phi0); + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double t; + + xy.y = xy.y * P->rk0 + P->phi0; + xy.x *= P->k0; + t = sqrt(1. - xy.x * xy.x); + lp.phi = asin(t * sin(xy.y)); + lp.lam = atan2(xy.x, t * cos(xy.y)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(tcea) + P->rk0 = 1 / P->k0; + P->inv = s_inverse; + P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_tmerc.c b/src/PJ_tmerc.c new file mode 100644 index 00000000..bac2db3e --- /dev/null +++ b/src/PJ_tmerc.c @@ -0,0 +1,148 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_tmerc.c 4.2 94/06/02 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double esp; \ + double ml0; \ + double *en; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(tmerc, "Transverse Mercator") "\n\tCyl, Sph&Ell"; +PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") + "\n\tCyl, Sph\n\tzone= south"; +#define EPS10 1.e-10 +#define aks0 P->esp +#define aks5 P->ml0 +#define FC1 1. +#define FC2 .5 +#define FC3 .16666666666666666666 +#define FC4 .08333333333333333333 +#define FC5 .05 +#define FC6 .03333333333333333333 +#define FC7 .02380952380952380952 +#define FC8 .01785714285714285714 +FORWARD(e_forward); /* ellipse */ + double al, als, n, cosphi, sinphi, t; + + sinphi = sin(lp.phi); cosphi = cos(lp.phi); + t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.; + t *= t; + al = cosphi * lp.lam; + als = al * al; + al /= sqrt(1. - P->es * sinphi * sinphi); + n = P->esp * cosphi * cosphi; + xy.x = P->k0 * al * (FC1 + + FC3 * als * (1. - t + n + + FC5 * als * (5. + t * (t - 18.) + n * (14. - 58. * t) + + FC7 * als * (61. + t * ( t * (179. - t) - 479. ) ) + ))); + xy.y = P->k0 * (pj_mlfn(lp.phi, sinphi, cosphi, P->en) - P->ml0 + + sinphi * al * lp.lam * FC2 * ( 1. + + FC4 * als * (5. - t + n * (9. + 4. * n) + + FC6 * als * (61. + t * (t - 58.) + n * (270. - 330 * t) + + FC8 * als * (1385. + t * ( t * (543. - t) - 3111.) ) + )))); + return (xy); +} +FORWARD(s_forward); /* sphere */ + double b, cosphi; + + b = (cosphi = cos(lp.phi)) * sin(lp.lam); + if (fabs(fabs(b) - 1.) <= EPS10) F_ERROR; + xy.x = aks5 * log((1. + b) / (1. - b)); + if ((b = fabs( xy.y = cosphi * cos(lp.lam) / sqrt(1. - b * b) )) >= 1.) { + if ((b - 1.) > EPS10) F_ERROR + else xy.y = 0.; + } else + xy.y = acos(xy.y); + if (lp.phi < 0.) xy.y = -xy.y; + xy.y = aks0 * (xy.y - P->phi0); + return (xy); +} +INVERSE(e_inverse); /* ellipsoid */ + double n, con, cosphi, d, ds, sinphi, t; + + lp.phi = pj_inv_mlfn(P->ml0 + xy.y / P->k0, P->es, P->en); + if (fabs(lp.phi) >= HALFPI) { + lp.phi = xy.y < 0. ? -HALFPI : HALFPI; + lp.lam = 0.; + } else { + sinphi = sin(lp.phi); + cosphi = cos(lp.phi); + t = fabs(cosphi) > 1e-10 ? sinphi/cosphi : 0.; + n = P->esp * cosphi * cosphi; + d = xy.x * sqrt(con = 1. - P->es * sinphi * sinphi) / P->k0; + con *= t; + t *= t; + ds = d * d; + lp.phi -= (con * ds / (1.-P->es)) * FC2 * (1. - + ds * FC4 * (5. + t * (3. - 9. * n) + n * (1. - 4 * n) - + ds * FC6 * (61. + t * (90. - 252. * n + + 45. * t) + 46. * n + - ds * FC8 * (1385. + t * (3633. + t * (4095. + 1574. * t)) ) + ))); + lp.lam = d*(FC1 - + ds*FC3*( 1. + 2.*t + n - + ds*FC5*(5. + t*(28. + 24.*t + 8.*n) + 6.*n + - ds * FC7 * (61. + t * (662. + t * (1320. + 720. * t)) ) + ))) / cosphi; + } + return (lp); +} +INVERSE(s_inverse); /* sphere */ + double h, g; + + h = exp(xy.x / aks0); + g = .5 * (h - 1. / h); + h = cos(P->phi0 + xy.y / aks0); + lp.phi = asin(sqrt((1. - h * h) / (1. + g * g))); + if (xy.y < 0.) lp.phi = -lp.phi; + lp.lam = (g || h) ? atan2(g, h) : 0.; + return (lp); +} +FREEUP; + if (P) { + if (P->en) + pj_dalloc(P->en); + pj_dalloc(P); + } +} + static PJ * +setup(PJ *P) { /* general initialization */ + if (P->es) { + if (!(P->en = pj_enfn(P->es))) + E_ERROR_0; + P->ml0 = pj_mlfn(P->phi0, sin(P->phi0), cos(P->phi0), P->en); + P->esp = P->es / (1. - P->es); + P->inv = e_inverse; + P->fwd = e_forward; + } else { + aks0 = P->k0; + aks5 = .5 * aks0; + P->inv = s_inverse; + P->fwd = s_forward; + } + return P; +} +ENTRY1(tmerc, en) +ENDENTRY(setup(P)) +ENTRY1(utm, en) + int zone; + + if (!P->es) E_ERROR(-34); + P->y0 = pj_param(P->params, "bsouth").i ? 10000000. : 0.; + P->x0 = 500000.; + if (pj_param(P->params, "tzone").i) /* zone input ? */ + if ((zone = pj_param(P->params, "izone").i) > 0 && zone <= 60) + --zone; + else + E_ERROR(-35) + else /* nearest central meridian input */ + if ((zone = floor((adjlon(P->lam0) + PI) * 30. / PI)) < 0) + zone = 0; + else if (zone >= 60) + zone = 59; + P->lam0 = (zone + .5) * PI / 30. - PI; + P->k0 = 0.9996; + P->phi0 = 0.; +ENDENTRY(setup(P)) diff --git a/src/PJ_tpeqd.c b/src/PJ_tpeqd.c new file mode 100644 index 00000000..ae9eb98a --- /dev/null +++ b/src/PJ_tpeqd.c @@ -0,0 +1,79 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_tpeqd.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double cp1, sp1, cp2, sp2, ccs, cs, sc, r2z0, z02, dlam2; \ + double hz0, thz0, rhshz0, ca, sa, lp, lamc; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(tpeqd, "Two Point Equidistant") + "\n\tMisc Sph\n\tlat_1= lon_1= lat_2= lon_2="; +FORWARD(s_forward); /* sphere */ + double t, z1, z2, dl1, dl2, sp, cp; + + sp = sin(lp.phi); + cp = cos(lp.phi); + z1 = aacos(P->sp1 * sp + P->cp1 * cp * cos(dl1 = lp.lam + P->dlam2)); + z2 = aacos(P->sp2 * sp + P->cp2 * cp * cos(dl2 = lp.lam - P->dlam2)); + z1 *= z1; + z2 *= z2; + xy.x = P->r2z0 * (t = z1 - z2); + t = P->z02 - t; + xy.y = P->r2z0 * asqrt(4. * P->z02 * z2 - t * t); + if ((P->ccs * sp - cp * (P->cs * sin(dl1) - P->sc * sin(dl2))) < 0.) + xy.y = -xy.y; + return xy; +} +INVERSE(s_inverse); /* sphere */ + double cz1, cz2, s, d, cp, sp; + + cz1 = cos(hypot(xy.y, xy.x + P->hz0)); + cz2 = cos(hypot(xy.y, xy.x - P->hz0)); + s = cz1 + cz2; + d = cz1 - cz2; + lp.lam = - atan2(d, (s * P->thz0)); + lp.phi = aacos(hypot(P->thz0 * s, d) * P->rhshz0); + if ( xy.y < 0. ) + lp.phi = - lp.phi; + /* lam--phi now in system relative to P1--P2 base equator */ + sp = sin(lp.phi); + cp = cos(lp.phi); + lp.phi = aasin(P->sa * sp + P->ca * cp * (s = cos(lp.lam -= P->lp))); + lp.lam = atan2(cp * sin(lp.lam), P->sa * cp * s - P->ca * sp) + P->lamc; + return lp; +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(tpeqd) + double lam_1, lam_2, phi_1, phi_2, A12, pp; + + /* get control point locations */ + phi_1 = pj_param(P->params, "rlat_1").f; + lam_1 = pj_param(P->params, "rlon_1").f; + phi_2 = pj_param(P->params, "rlat_2").f; + lam_2 = pj_param(P->params, "rlon_2").f; + if (phi_1 == phi_2 && lam_1 == lam_2) E_ERROR(-25); + P->lam0 = adjlon(0.5 * (lam_1 + lam_2)); + P->dlam2 = adjlon(lam_2 - lam_1); + P->cp1 = cos(phi_1); + P->cp2 = cos(phi_2); + P->sp1 = sin(phi_1); + P->sp2 = sin(phi_2); + P->cs = P->cp1 * P->sp2; + P->sc = P->sp1 * P->cp2; + P->ccs = P->cp1 * P->cp2 * sin(P->dlam2); + P->z02 = aacos(P->sp1 * P->sp2 + P->cp1 * P->cp2 * cos(P->dlam2)); + P->hz0 = .5 * P->z02; + A12 = atan2(P->cp2 * sin(P->dlam2), + P->cp1 * P->sp2 - P->sp1 * P->cp2 * cos(P->dlam2)); + P->ca = cos(pp = aasin(P->cp1 * sin(A12))); + P->sa = sin(pp); + P->lp = adjlon(atan2(P->cp1 * cos(A12), P->sp1) - P->hz0); + P->dlam2 *= .5; + P->lamc = HALFPI - atan2(sin(A12) * P->sp1, cos(A12)) - P->dlam2; + P->thz0 = tan(P->hz0); + P->rhshz0 = .5 / sin(P->hz0); + P->r2z0 = 0.5 / P->z02; + P->z02 *= P->z02; + P->inv = s_inverse; P->fwd = s_forward; + P->es = 0.; +ENDENTRY(P) diff --git a/src/PJ_urm5.c b/src/PJ_urm5.c new file mode 100644 index 00000000..32cf29bf --- /dev/null +++ b/src/PJ_urm5.c @@ -0,0 +1,31 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_urm5.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double m, rmn, q3, n; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(urm5, "Urmaev V") "\n\tPCyl., Sph.\n\tn= q= alphi="; +FORWARD(s_forward); /* spheroid */ + double t; + + t = lp.phi = aasin(P->n * sin(lp.phi)); + xy.x = P->m * lp.lam * cos(lp.phi); + t *= t; + xy.y = lp.phi * (1. + t * P->q3) * P->rmn; + return xy; +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(urm5) + double alpha, t; + + P->n = pj_param(P->params, "dn").f; + P->q3 = pj_param(P->params, "dq").f / 3.; + alpha = pj_param(P->params, "ralpha").f; + t = P->n * sin(alpha); + P->m = cos(alpha) / sqrt(1. - t * t); + P->rmn = 1. / (P->m * P->n); + P->es = 0.; + P->inv = 0; + P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_urmfps.c b/src/PJ_urmfps.c new file mode 100644 index 00000000..912be1d9 --- /dev/null +++ b/src/PJ_urmfps.c @@ -0,0 +1,43 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_urmfps.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double n, C_y; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(urmfps, "Urmaev Flat-Polar Sinusoidal") "\n\tPCyl, Sph.\n\tn="; +PROJ_HEAD(wag1, "Wagner I (Kavraisky VI)") "\n\tPCyl, Sph."; +#define C_x 0.8773826753 +#define Cy 1.139753528477 +FORWARD(s_forward); /* sphere */ + lp.phi = aasin(P->n * sin(lp.phi)); + xy.x = C_x * lp.lam * cos(lp.phi); + xy.y = P->C_y * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* sphere */ + xy.y /= P->C_y; + lp.phi = aasin(sin(xy.y) / P->n); + lp.lam = xy.x / (C_x * cos(xy.y)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } + static PJ * +setup(PJ *P) { + P->C_y = Cy / P->n; + P->es = 0.; + P->inv = s_inverse; + P->fwd = s_forward; + return P; +} +ENTRY0(urmfps) + if (pj_param(P->params, "tn").i) { + P->n = pj_param(P->params, "dn").f; + if (P->n <= 0. || P->n > 1.) + E_ERROR(-40) + } else + E_ERROR(-40) +ENDENTRY(setup(P)) +ENTRY0(wag1) + P->n = 0.8660254037844386467637231707; +ENDENTRY(setup(P)) diff --git a/src/PJ_vandg.c b/src/PJ_vandg.c new file mode 100644 index 00000000..b6168e06 --- /dev/null +++ b/src/PJ_vandg.c @@ -0,0 +1,81 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_vandg.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(vandg, "van der Grinten (I)") "\n\tMisc Sph"; +# define TOL 1.e-10 +# define THIRD .33333333333333333333 +# define TWO_THRD .66666666666666666666 +# define C2_27 .07407407407407407407 +# define PI4_3 4.18879020478639098458 +# define PISQ 9.86960440108935861869 +# define TPISQ 19.73920880217871723738 +# define HPISQ 4.93480220054467930934 +FORWARD(s_forward); /* spheroid */ + double al, al2, g, g2, p2; + + p2 = fabs(lp.phi / HALFPI); + if ((p2 - TOL) > 1.) F_ERROR; + if (p2 > 1.) + p2 = 1.; + if (fabs(lp.phi) <= TOL) { + xy.x = lp.lam; + xy.y = 0.; + } else if (fabs(lp.lam) <= TOL || fabs(p2 - 1.) < TOL) { + xy.x = 0.; + xy.y = PI * tan(.5 * asin(p2)); + if (lp.phi < 0.) xy.y = -xy.y; + } else { + al = .5 * fabs(PI / lp.lam - lp.lam / PI); + al2 = al * al; + g = sqrt(1. - p2 * p2); + g = g / (p2 + g - 1.); + g2 = g * g; + p2 = g * (2. / p2 - 1.); + p2 = p2 * p2; + xy.x = g - p2; g = p2 + al2; + xy.x = PI * (al * xy.x + sqrt(al2 * xy.x * xy.x - g * (g2 - p2))) / g; + if (lp.lam < 0.) xy.x = -xy.x; + xy.y = fabs(xy.x / PI); + xy.y = 1. - xy.y * (xy.y + 2. * al); + if (xy.y < -TOL) F_ERROR; + if (xy.y < 0.) xy.y = 0.; + else xy.y = sqrt(xy.y) * (lp.phi < 0. ? -PI : PI); + } + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + double t, c0, c1, c2, c3, al, r2, r, m, d, ay, x2, y2; + + x2 = xy.x * xy.x; + if ((ay = fabs(xy.y)) < TOL) { + lp.phi = 0.; + t = x2 * x2 + TPISQ * (x2 + HPISQ); + lp.lam = fabs(xy.x) <= TOL ? 0. : + .5 * (x2 - PISQ + sqrt(t)) / xy.x; + return (lp); + } + y2 = xy.y * xy.y; + r = x2 + y2; r2 = r * r; + c1 = - PI * ay * (r + PISQ); + c3 = r2 + TWOPI * (ay * r + PI * (y2 + PI * (ay + HALFPI))); + c2 = c1 + PISQ * (r - 3. * y2); + c0 = PI * ay; + c2 /= c3; + al = c1 / c3 - THIRD * c2 * c2; + m = 2. * sqrt(-THIRD * al); + d = C2_27 * c2 * c2 * c2 + (c0 * c0 - THIRD * c2 * c1) / c3; + if (((t = fabs(d = 3. * d / (al * m))) - TOL) <= 1.) { + d = t > 1. ? (d > 0. ? 0. : PI) : acos(d); + lp.phi = PI * (m * cos(d * THIRD + PI4_3) - THIRD * c2); + if (xy.y < 0.) lp.phi = -lp.phi; + t = r2 + TPISQ * (x2 - y2 + HPISQ); + lp.lam = fabs(xy.x) <= TOL ? 0. : + .5 * (r - PISQ + (t <= 0. ? 0. : sqrt(t))) / xy.x; + } else + I_ERROR; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(vandg) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_vandg2.c b/src/PJ_vandg2.c new file mode 100644 index 00000000..7e96a5c6 --- /dev/null +++ b/src/PJ_vandg2.c @@ -0,0 +1,48 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_vandg2.c 4.1 94/02/15 GIE REL"; +#endif +# define TOL 1e-10 +# define TWORPI 0.63661977236758134308 +#define PROJ_PARMS__ \ + int vdg3; +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(vandg2, "van der Grinten II") "\n\tMisc Sph, no inv."; +PROJ_HEAD(vandg3, "van der Grinten III") "\n\tMisc Sph, no inv."; +FORWARD(s_forward); /* spheroid */ + double x1, at, bt, ct; + + bt = fabs(TWORPI * lp.phi); + if ((ct = 1. - bt * bt) < 0.) + ct = 0.; + else + ct = sqrt(ct); + if (fabs(lp.lam) < TOL) { + xy.x = 0.; + xy.y = PI * (lp.phi < 0. ? -bt : bt) / (1. + ct); + } else { + at = 0.5 * fabs(PI / lp.lam - lp.lam / PI); + if (P->vdg3) { + x1 = bt / (1. + ct); + xy.x = PI * (sqrt(at * at + 1. - x1 * x1) - at); + xy.y = PI * x1; + } else { + x1 = (ct * sqrt(1. + at * at) - at * ct * ct) / + (1. + at * at * bt * bt); + xy.x = PI * x1; + xy.y = PI * sqrt(1. - x1 * (x1 + 2. * at) + TOL); + } + if ( lp.lam < 0.) xy.x = -xy.x; + if ( lp.phi < 0.) xy.y = -xy.y; + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(vandg2) + P->vdg3 = 0; + P->inv = 0; P->fwd = s_forward; +ENDENTRY(P) +ENTRY0(vandg3) + P->vdg3 = 1; + P->es = 0.; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_vandg4.c b/src/PJ_vandg4.c new file mode 100644 index 00000000..9789bf97 --- /dev/null +++ b/src/PJ_vandg4.c @@ -0,0 +1,44 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_vandg4.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(vandg4, "van der Grinten IV") "\n\tMisc Sph, no inv."; +#define TOL 1e-10 +#define TWORPI 0.63661977236758134308 +FORWARD(s_forward); /* spheroid */ + double x1, t, bt, ct, ft, bt2, ct2, dt, dt2; + + if (fabs(lp.phi) < TOL) { + xy.x = lp.lam; + xy.y = 0.; + } else if (fabs(lp.lam) < TOL || fabs(fabs(lp.phi) - HALFPI) < TOL) { + xy.x = 0.; + xy.y = lp.phi; + } else { + bt = fabs(TWORPI * lp.phi); + bt2 = bt * bt; + ct = 0.5 * (bt * (8. - bt * (2. + bt2)) - 5.) + / (bt2 * (bt - 1.)); + ct2 = ct * ct; + dt = TWORPI * lp.lam; + dt = dt + 1. / dt; + dt = sqrt(dt * dt - 4.); + if ((fabs(lp.lam) - HALFPI) < 0.) dt = -dt; + dt2 = dt * dt; + x1 = bt + ct; x1 *= x1; + t = bt + 3.*ct; + ft = x1 * (bt2 + ct2 * dt2 - 1.) + (1.-bt2) * ( + bt2 * (t * t + 4. * ct2) + + ct2 * (12. * bt * ct + 4. * ct2) ); + x1 = (dt*(x1 + ct2 - 1.) + 2.*sqrt(ft)) / + (4.* x1 + dt2); + xy.x = HALFPI * x1; + xy.y = HALFPI * sqrt(1. + dt * fabs(x1) - x1 * x1); + if (lp.lam < 0.) xy.x = -xy.x; + if (lp.phi < 0.) xy.y = -xy.y; + } + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(vandg4) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_wag2.c b/src/PJ_wag2.c new file mode 100644 index 00000000..d6a0e3f2 --- /dev/null +++ b/src/PJ_wag2.c @@ -0,0 +1,24 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_wag2.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(wag2, "Wagner II") "\n\tPCyl., Sph."; +#define C_x 0.92483 +#define C_y 1.38725 +#define C_p1 0.88022 +#define C_p2 0.88550 +FORWARD(s_forward); /* spheroid */ + lp.phi = aasin(C_p1 * sin(C_p2 * lp.phi)); + xy.x = C_x * lp.lam * cos(lp.phi); + xy.y = C_y * lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y / C_y; + lp.lam = xy.x / (C_x * cos(lp.phi)); + lp.phi = aasin(sin(lp.phi) / C_p1) / C_p2; + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(wag2) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) diff --git a/src/PJ_wag3.c b/src/PJ_wag3.c new file mode 100644 index 00000000..30b1a38a --- /dev/null +++ b/src/PJ_wag3.c @@ -0,0 +1,27 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_wag3.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double C_x; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(wag3, "Wagner III") "\n\tPCyl., Sph."; +#define TWOTHIRD 0.6666666666666666666667 +FORWARD(s_forward); /* spheroid */ + xy.x = P->C_x * lp.lam * cos(TWOTHIRD * lp.phi); + xy.y = lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y; + lp.lam = xy.x / (P->C_x * cos(TWOTHIRD * lp.phi)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(wag3) + double ts; + + ts = pj_param(P->params, "rlat_ts").f; + P->C_x = cos(ts) / cos(2.*ts/3.); + P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_wag7.c b/src/PJ_wag7.c new file mode 100644 index 00000000..7fd5e58d --- /dev/null +++ b/src/PJ_wag7.c @@ -0,0 +1,17 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_wag7.c 4.1 94/02/15 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +PROJ_HEAD(wag7, "Wagner VII") "\n\tMisc Sph, no inv."; +FORWARD(s_forward); /* sphere */ + double theta, ct, D; + + theta = asin(xy.y = 0.90630778703664996 * sin(lp.phi)); + xy.x = 2.66723 * (ct = cos(theta)) * sin(lp.lam /= 3.); + xy.y *= 1.24104 * (D = 1/(sqrt(0.5 * (1 + ct * cos(lp.lam))))); + xy.x *= D; + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(wag7) P->fwd = s_forward; P->inv = 0; P->es = 0.; ENDENTRY(P) diff --git a/src/PJ_wink1.c b/src/PJ_wink1.c new file mode 100644 index 00000000..bee666e6 --- /dev/null +++ b/src/PJ_wink1.c @@ -0,0 +1,23 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_wink1.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double cosphi1; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(wink1, "Winkel I") "\n\tPCyl., Sph.\n\tlat_ts="; +FORWARD(s_forward); /* spheroid */ + xy.x = .5 * lp.lam * (P->cosphi1 + cos(lp.phi)); + xy.y = lp.phi; + return (xy); +} +INVERSE(s_inverse); /* spheroid */ + lp.phi = xy.y; + lp.lam = 2. * xy.x / (P->cosphi1 + cos(lp.phi)); + return (lp); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(wink1) + P->cosphi1 = cos(pj_param(P->params, "rlat_ts").f); + P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/PJ_wink2.c b/src/PJ_wink2.c new file mode 100644 index 00000000..2e8c0a75 --- /dev/null +++ b/src/PJ_wink2.c @@ -0,0 +1,37 @@ +#ifndef lint +static const char SCCSID[]="@(#)PJ_wink2.c 4.1 94/02/15 GIE REL"; +#endif +#define PROJ_PARMS__ \ + double cosphi1; +#define PJ_LIB__ +# include <projects.h> +PROJ_HEAD(wink2, "Winkel II") "\n\tPCyl., Sph., no inv.\n\tlat_1="; +#define MAX_ITER 10 +#define LOOP_TOL 1e-7 +#define TWO_D_PI 0.636619772367581343 +FORWARD(s_forward); /* spheroid */ + double k, V; + int i; + + xy.y = lp.phi * TWO_D_PI; + k = PI * sin(lp.phi); + lp.phi *= 1.8; + for (i = MAX_ITER; i ; --i) { + lp.phi -= V = (lp.phi + sin(lp.phi) - k) / + (1. + cos(lp.phi)); + if (fabs(V) < LOOP_TOL) + break; + } + if (!i) + lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; + else + lp.phi *= 0.5; + xy.x = 0.5 * lp.lam * (cos(lp.phi) + P->cosphi1); + xy.y = FORTPI * (sin(lp.phi) + xy.y); + return (xy); +} +FREEUP; if (P) pj_dalloc(P); } +ENTRY0(wink2) + P->cosphi1 = cos(pj_param(P->params, "rlat_1").f); + P->es = 0.; P->inv = 0; P->fwd = s_forward; +ENDENTRY(P) diff --git a/src/README b/src/README new file mode 100644 index 00000000..35c60a4e --- /dev/null +++ b/src/README @@ -0,0 +1,73 @@ + Installation README --- @(#)README 4.4 94/10/05 GIE REL" + +At the current time, installation only performed to PROJ.4 directory and +information not transfered via normal "install(1)" function because of +the diversity of system variations. + +There are occasional errors encountered with "ranlib." Makefile tests +for presence in either /bin or /usr/bin and will execute. Even if found, +some systems choke. Such choking is ignored with no apparent ill results. + +As an alternative to editing the head of the Makefile, the following can +be used on the run line: + +For Suns without vendor ANSI C compiler, use GNU's gcc and + make install CC=gcc COMP='-O -DNO_STRERRNO' +Apparently the name max is missing from gcc includes and the Sun +library does not include the ANSI strerrno function. + +For DEC Ultrix: (brain damaged strtod implementation) + make install STRTOD='$L(strtod.o)' +The DEC people just can't seem to forget the dinosaur FORTRAN. +Ignore compiler warnings about "unimplemented const." + +For Dell SVR4 issue 2.2 do + make install + +For Data General: + make install COMP='-O -ansi' +Ranlib in system but execution denied(?)---error ignored. + +If repeatative compilations or linkages are expected, it is better +to edit these flags into the beginning of the Makefile after saving +a copy of the original. + +Check /usr/include/math.h for prototype of hypot. If missing it is +probably not in libm.a and it is necessary to use supplied version. + + make install HYPOT='$L(hypot.o)' + or + make install HYPOT='$L(hypot.o)' STRTOD='$L(strtod.o)' + +To check for brain damaged versions of strtod try the following after +using the local system's version (default): + +proj +proj=poly +ellps=clrk66 +no_defs <<EOF +3.5 33.25 +3d30 33d15 +EOF + +Both geographic coordinates should produce the same cartesian result. +If not, then it is almost a certainty that libc.a has a version modified +to accept d | D as an alternative to e | E. This "extension" to ANSI +specifications causes untold grief. Use the ANSI compliant GNU version +included. + +The default installation library is set at /usr/local/lib even though +actual transfer of files not made. To set to an alternative library +use LIB=<library path> on the make run-line or edit Makefile. + +To truely install: + + BIN=<favorite executable area? + LIB=<basic library area, same as in Makefile's> + INC=<include file area> + cp proj $BIN + ln ${BIN}/proj ${BIN}/invproj + cp geod $BIN + cp proj_def.dat $LIB/proj + cp libproj.a $LIB + cp projects.h $INC + cd ../nad + cp nad27 $LIB/proj + cp nad83 $LIB/proj diff --git a/src/aasincos.c b/src/aasincos.c new file mode 100644 index 00000000..27aab829 --- /dev/null +++ b/src/aasincos.c @@ -0,0 +1,36 @@ +/* arc sin, cosine, tan2 and sqrt that will NOT fail */ +#ifndef lint +static const char SCCSID[]="@(#)aasincos.c 4.6 93/12/12 GIE REL"; +#endif +#include <projects.h> +#define ONE_TOL 1.00000000000001 +#define TOL 0.000000001 +#define ATOL 1e-50 + double +aasin(double v) { + double av; + + if ((av = fabs(v)) >= 1.) { + if (av > ONE_TOL) + pj_errno = -19; + return (v < 0. ? -HALFPI : HALFPI); + } + return asin(v); +} + double +aacos(double v) { + double av; + + if ((av = fabs(v)) >= 1.) { + if (av > ONE_TOL) + pj_errno = -19; + return (v < 0. ? PI : 0.); + } + return acos(v); +} + double +asqrt(double v) { return ((v <= 0) ? 0. : sqrt(v)); } + double +aatan2(double n, double d) { + return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0. : atan2(n,d)); +} diff --git a/src/adjlon.c b/src/adjlon.c new file mode 100644 index 00000000..3de12a16 --- /dev/null +++ b/src/adjlon.c @@ -0,0 +1,16 @@ +/* reduce argument to range +/- PI */ +#ifndef lint +static const char SCCSID[]="@(#)adjlon.c 4.3 93/06/12 GIE REL"; +#endif +#include <math.h> +/* note: PI adjusted high +** approx. true val: 3.14159265358979323844 +*/ +#define SPI 3.14159265359 +#define TWOPI 6.2831853071795864769 + double +adjlon (double lon) { + while ( fabs(lon) > SPI ) + lon += lon < 0. ? TWOPI : -TWOPI; + return( lon ); +} diff --git a/src/bch2bps.c b/src/bch2bps.c new file mode 100644 index 00000000..0d773575 --- /dev/null +++ b/src/bch2bps.c @@ -0,0 +1,143 @@ +/* convert bivariate w Chebyshev series to w Power series */ +#ifndef lint +static const char SCCSID[]="@(#)bch2bps.c 4.5 94/03/22 GIE REL"; +#endif +#include <projects.h> +/* basic support procedures */ + static void /* clear vector to zero */ +clear(UV *p, int n) { static const UV c = {0., 0.}; while (n--) *p++ = c; } + static void /* clear matrix rows to zero */ +bclear(UV **p, int n, int m) { while (n--) clear(*p++, m); } + static void /* move vector */ +bmove(UV *a, UV *b, int n) { while (n--) *a++ = *b++; } + static void /* a <- m * b - c */ +submop(UV *a, double m, UV *b, UV *c, int n) { + while (n--) { + a->u = m * b->u - c->u; + a++->v = m * b++->v - c++->v; + } +} + static void /* a <- b - c */ +subop(UV *a, UV *b, UV *c, int n) { + while (n--) { + a->u = b->u - c->u; + a++->v = b++->v - c++->v; + } +} + static void /* multiply vector a by scalar m */ +dmult(UV *a, double m, int n) { while(n--) { a->u *= m; a->v *= m; ++a; } } + static void /* row adjust a[] <- a[] - m * b[] */ +dadd(UV *a, UV *b, double m, int n) { + while(n--) { + a->u -= m * b->u; + a++->v -= m * b++->v; + } +} + static void /* convert row to pover series */ +rows(UV *c, UV *d, int n) { + UV sv, *dd; + int j, k; + + dd = (UV *)vector1(n-1, sizeof(UV)); + sv.u = sv.v = 0.; + for (j = 0; j < n; ++j) d[j] = dd[j] = sv; + d[0] = c[n-1]; + for (j = n-2; j >= 1; --j) { + for (k = n-j; k >= 1; --k) { + sv = d[k]; + d[k].u = 2. * d[k-1].u - dd[k].u; + d[k].v = 2. * d[k-1].v - dd[k].v; + dd[k] = sv; + } + sv = d[0]; + d[0].u = -dd[0].u + c[j].u; + d[0].v = -dd[0].v + c[j].v; + dd[0] = sv; + } + for (j = n-1; j >= 1; --j) { + d[j].u = d[j-1].u - dd[j].u; + d[j].v = d[j-1].v - dd[j].v; + } + d[0].u = -dd[0].u + .5 * c[0].u; + d[0].v = -dd[0].v + .5 * c[0].v; + pj_dalloc(dd); +} + static void /* convert columns to power series */ +cols(UV **c, UV **d, int nu, int nv) { + UV *sv, **dd; + int j, k; + + dd = (UV **)vector2(nu, nv, sizeof(UV)); + sv = (UV *)vector1(nv, sizeof(UV)); + bclear(d, nu, nv); + bclear(dd, nu, nv); + bmove(d[0], c[nu-1], nv); + for (j = nu-2; j >= 1; --j) { + for (k = nu-j; k >= 1; --k) { + bmove(sv, d[k], nv); + submop(d[k], 2., d[k-1], dd[k], nv); + bmove(dd[k], sv, nv); + } + bmove(sv, d[0], nv); + subop(d[0], c[j], dd[0], nv); + bmove(dd[0], sv, nv); + } + for (j = nu-1; j >= 1; --j) + subop(d[j], d[j-1], dd[j], nv); + submop(d[0], .5, c[0], dd[0], nv); + freev2(dd, nu); + pj_dalloc(sv); +} + static void /* row adjust for range -1 to 1 to a to b */ +rowshft(double a, double b, UV *d, int n) { + int k, j; + double fac, cnst; + + cnst = 2. / (b - a); + fac = cnst; + for (j = 1; j < n; ++j) { + d[j].u *= fac; + d[j].v *= fac; + fac *= cnst; + } + cnst = .5 * (a + b); + for (j = 0; j <= n-2; ++j) + for (k = n - 2; k >= j; --k) { + d[k].u -= cnst * d[k+1].u; + d[k].v -= cnst * d[k+1].v; + } +} + static void /* column adjust for range -1 to 1 to a to b */ +colshft(double a, double b, UV **d, int n, int m) { + int k, j; + double fac, cnst; + + cnst = 2. / (b - a); + fac = cnst; + for (j = 1; j < n; ++j) { + dmult(d[j], fac, m); + fac *= cnst; + } + cnst = .5 * (a + b); + for (j = 0; j <= n-2; ++j) + for (k = n - 2; k >= j; --k) + dadd(d[k], d[k+1], cnst, m); +} + int /* entry point */ +bch2bps(UV a, UV b, UV **c, int nu, int nv) { + UV **d; + int i; + + if (nu < 1 || nv < 1 || !(d = (UV **)vector2(nu, nv, sizeof(UV)))) + return 0; + /* do rows to power series */ + for (i = 0; i < nu; ++i) { + rows(c[i], d[i], nv); + rowshft(a.v, b.v, d[i], nv); + } + /* do columns to power series */ + cols(d, c, nu, nv); + colshft(a.u, b.u, c, nu, nv); + freev2(d, nu); + return 1; +} diff --git a/src/bchgen.c b/src/bchgen.c new file mode 100644 index 00000000..cc03f037 --- /dev/null +++ b/src/bchgen.c @@ -0,0 +1,61 @@ +/* generate double bivariate Chebychev polynomial */ +#ifndef lint +static const char SCCSID[]="@(#)bchgen.c 4.5 94/03/22 GIE REL"; +#endif +#include <projects.h> + int +bchgen(UV a, UV b, int nu, int nv, UV **f, UV(*func)(UV)) { + int i, j, k; + UV arg, *t, bma, bpa, *c; + double d, fac; + + bma.u = 0.5 * (b.u - a.u); bma.v = 0.5 * (b.v - a.v); + bpa.u = 0.5 * (b.u + a.u); bpa.v = 0.5 * (b.v + a.v); + for ( i = 0; i < nu; ++i) { + arg.u = cos(PI * (i + 0.5) / nu) * bma.u + bpa.u; + for ( j = 0; j < nv; ++j) { + arg.v = cos(PI * (j + 0.5) / nv) * bma.v + bpa.v; + f[i][j] = (*func)(arg); + if ((f[i][j]).u == HUGE_VAL) + return(1); + } + } + if (!(c = vector1(nu, sizeof(UV)))) return 1; + fac = 2. / nu; + for ( j = 0; j < nv ; ++j) { + for ( i = 0; i < nu; ++i) { + arg.u = arg.v = 0.; + for (k = 0; k < nu; ++k) { + d = cos(PI * i * (k + .5) / nu); + arg.u += f[k][j].u * d; + arg.v += f[k][j].v * d; + } + arg.u *= fac; + arg.v *= fac; + c[i] = arg; + } + for (i = 0; i < nu; ++i) + f[i][j] = c[i]; + } + pj_dalloc(c); + if (!(c = vector1(nv, sizeof(UV)))) return 1; + fac = 2. / nv; + for ( i = 0; i < nu; ++i) { + t = f[i]; + for (j = 0; j < nv; ++j) { + arg.u = arg.v = 0.; + for (k = 0; k < nv; ++k) { + d = cos(PI * j * (k + .5) / nv); + arg.u += t[k].u * d; + arg.v += t[k].v * d; + } + arg.u *= fac; + arg.v *= fac; + c[j] = arg; + } + f[i] = c; + c = t; + } + pj_dalloc(c); + return(0); +} diff --git a/src/biveval.c b/src/biveval.c new file mode 100644 index 00000000..3dcd7461 --- /dev/null +++ b/src/biveval.c @@ -0,0 +1,83 @@ +/* procedures for evaluating Tseries */ +#ifndef lint +static const char SCCSID[]="@(#)biveval.c 4.4 93/06/12 GIE REL"; +#endif +# include <projects.h> +# define NEAR_ONE 1.00001 + static UV +w2, w; + static double /* basic bivariate Chebyshev evaluation */ +ceval(C, n) struct PW_COEF *C; { + double d=0, dd=0, vd, vdd, tmp, *c; + int j; + + for (C += n ; n-- ; --C ) { + if (j = C->m) { + vd = vdd = 0.; + for (c = C->c + --j; j ; --j ) { + vd = w2.v * (tmp = vd) - vdd + *c--; + vdd = tmp; + } + d = w2.u * (tmp = d) - dd + w.v * vd - vdd + 0.5 * *c; + } else + d = w2.u * (tmp = d) - dd; + dd = tmp; + } + if (j = C->m) { + vd = vdd = 0.; + for (c = C->c + --j; j ; --j ) { + vd = w2.v * (tmp = vd) - vdd + *c--; + vdd = tmp; + } + return (w.u * d - dd + 0.5 * ( w.v * vd - vdd + 0.5 * *c )); + } else + return (w.u * d - dd); +} + UV /* bivariate Chebyshev polynomial entry point */ +bcheval(UV in, Tseries *T) { + UV out; + /* scale to +-1 */ + w.u = ( in.u + in.u - T->a.u ) * T->b.u; + w.v = ( in.v + in.v - T->a.v ) * T->b.v; + if (fabs(w.u) > NEAR_ONE || fabs(w.v) > NEAR_ONE) { + out.u = out.v = HUGE_VAL; + pj_errno = -36; + } else { /* double evaluation */ + w2.u = w.u + w.u; + w2.v = w.v + w.v; + out.u = ceval(T->cu, T->mu); + out.v = ceval(T->cv, T->mv); + } + return out; +} + UV /* bivariate power polynomial entry point */ +bpseval(UV in, Tseries *T) { + UV out; + double *c, row; + int i, m; + + out.u = out.v = 0.; + for (i = T->mu; i >= 0; --i) { + row = 0.; + if (m = T->cu[i].m) { + c = T->cu[i].c + m; + while (m--) + row = *--c + in.v * row; + } + out.u = row + in.u * out.u; + } + for (i = T->mv; i >= 0; --i) { + row = 0.; + if (m = T->cv[i].m) { + c = T->cv[i].c + m; + while (m--) + row = *--c + in.v * row; + } + out.v = row + in.u * out.v; + } + return out; +} + UV /* general entry point selecting evaluation mode */ +biveval(UV in, Tseries *T) { + return (T->power ? bpseval(in, T) : bcheval(in, T)); +} diff --git a/src/dmstor.c b/src/dmstor.c new file mode 100644 index 00000000..5b4bccf1 --- /dev/null +++ b/src/dmstor.c @@ -0,0 +1,78 @@ +/* Convert DMS string to radians */ +#ifndef lint +static const char SCCSID[]="@(#)dmstor.c 4.4 93/06/16 GIE REL"; +#endif +#include <projects.h> +#include <string.h> +#include <ctype.h> + +/* following should be sufficient for all but the rediculous */ +#define MAX_WORK 64 + static const char +*sym = "NnEeSsWw"; + static const double +vm[] = { + .0174532925199433, + .0002908882086657216, + .0000048481368110953599 +}; + double +dmstor(const char *is, char **rs) { + int sign, n, nl; + char *p, *s, work[MAX_WORK]; + double v, tv; + + if (rs) + *rs = (char *)is; + /* copy sting into work space */ + while (isspace(sign = *is)) ++is; + for (n = MAX_WORK, s = work, p = (char *)is; isgraph(*p) && --n ; ) + *s++ = *p++; + *s = '\0'; + /* it is possible that a really odd input (like lots of leading + zeros) could be truncated in copying into work. But ... */ + sign = *(s = work); + if (sign == '+' || sign == '-') s++; + else sign = '+'; + for (v = 0., nl = 0 ; nl < 3 ; nl = n + 1 ) { + if (!(isdigit(*s) || *s == '.')) break; + if ((tv = strtod(s, &s)) == HUGE_VAL) + return tv; + switch (*s) { + case 'D': case 'd': + n = 0; break; + case '\'': + n = 1; break; + case '"': + n = 2; break; + case 'r': case 'R': + if (nl) { + pj_errno = -16; + return HUGE_VAL; + } + ++s; + v = tv; + goto skip; + default: + v += tv * vm[nl]; + skip: n = 4; + continue; + } + if (n < nl) { + pj_errno = -16; + return HUGE_VAL; + } + v += tv * vm[n]; + ++s; + } + /* postfix sign */ + if (*s && (p = strchr(sym, *s))) { + sign = (p - sym) >= 4 ? '-' : '+'; + ++s; + } + if (sign == '-') + v = -v; + if (rs) /* return point of next char after valid string */ + *rs = (char *)is + (s - work); + return v; +} diff --git a/src/emess.c b/src/emess.c new file mode 100644 index 00000000..9e357f9f --- /dev/null +++ b/src/emess.c @@ -0,0 +1,50 @@ +/* Error message processing */ +#ifndef lint +static const char SCCSID[]="@(#)emess.c 4.6 94/05/24 GIE REL"; +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <errno.h> +#include <string.h> +#define EMESS_ROUTINE +#include "emess.h" +extern char const pj_release[]; + void +emess(int code, char *fmt, ...) { + va_list args; + + va_start(args, fmt); + /* prefix program name, if given */ + if (fmt != NULL) + (void)fprintf(stderr,"%s\n<%s>: ",pj_release,emess_dat.Prog_name); + /* print file name and line, if given */ + if (emess_dat.File_name != NULL && *emess_dat.File_name) { + (void)fprintf(stderr,"while processing file: %s", emess_dat.File_name); + if (emess_dat.File_line > 0) + (void)fprintf(stderr,", line %d\n", emess_dat.File_line); + else + (void)fputc('\n', stderr); + } else + putc('\n', stderr); + /* if |code|==2, print errno code data */ + if (code == 2 || code == -2) + (void)fprintf(stderr, "Sys errno: %d: %s\n", + errno, +#ifdef HAVE_STRERROR + strerror(errno)); +#else + "<system mess. texts unavail.>"); +#endif + /* post remainder of call data */ + (void)vfprintf(stderr,fmt,args); + va_end(args); + /* die if code positive */ + if (code > 0) { + (void)fputs("\nprogram abnormally terminated\n", stderr); + exit(code); + } + else + putc('\n', stderr); +} diff --git a/src/emess.h b/src/emess.h new file mode 100644 index 00000000..6724a065 --- /dev/null +++ b/src/emess.h @@ -0,0 +1,32 @@ +/* Error message processing header file */ +#ifndef EMESS_H +#define EMESS_H + +#ifndef lint +static char EMESS_H_ID[] = "@(#)emess.h 4.1 93/03/08 GIE REL"; +#endif + +struct EMESS { + char *File_name, /* input file name */ + *Prog_name; /* name of program */ + int File_line; /* approximate line read + where error occured */ +}; + +#ifdef EMESS_ROUTINE /* use type */ +/* for emess procedure */ +struct EMESS emess_dat = { (char *)0, (char *)0, 0 }; + +#ifdef sun /* Archaic SunOs 4.1.1, etc. */ +extern char *sys_errlist[]; +#define strerror(n) (sys_errlist[n]) +#endif + +#else /* for for calling procedures */ + +extern struct EMESS emess_dat; +void emess(int, char *, ...); + +#endif /* use type */ + +#endif /* end EMESS_H */ diff --git a/src/gen_cheb.c b/src/gen_cheb.c new file mode 100644 index 00000000..14ac3ce9 --- /dev/null +++ b/src/gen_cheb.c @@ -0,0 +1,74 @@ +/* generates 'T' option output */ +#ifndef lint +static const char SCCSID[]="@(#)gen_cheb.c 4.9 95/09/23 GIE REL"; +#endif +#define PJ_LIB__ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <projects.h> +#include "emess.h" +#ifndef COEF_LINE_MAX +#define COEF_LINE_MAX 60 +#endif + void +gen_cheb(int inverse, UV (*proj)(), char *s, PJ *P, int iargc, char **iargv) { + int NU = 15, NV = 15, i, res = -1, errin = 0, pwr; + char *arg, fmt[15]; + UV low, upp, resid; + Tseries *F; + extern void p_series(Tseries *, FILE *, char *); + double (*input)(); + + input = inverse ? strtod : dmstor; + if (*s) low.u = input(s, &s); else ++errin; + if (*s == ',') upp.u = input(s+1, &s); else ++errin; + if (*s == ',') low.v = input(s+1, &s); else ++errin; + if (*s == ',') upp.v = input(s+1, &s); else ++errin; + if (errin) + emess(16,"null or absent -T parameters"); + if (*s == ',') if (*++s != ',') res = strtol(s, &s, 10); + if (*s == ',') if (*++s != ',') NU = strtol(s, &s, 10); + if (*s == ',') if (*++s != ',') NV = strtol(s, &s, 10); + pwr = s && *s && !strcmp(s, ",P"); + (void)printf("#proj_%s\n# run-line:\n", + pwr ? "Power" : "Chebyshev"); + if (iargc > 0) { /* proj execution audit trail */ + int n = 0, L; + + for( i = 0 ; iargc ; --iargc) { + arg = *iargv++; + if (*arg != '+') { + if (!n) { putchar('#'); ++n; } + (void)printf(" %s%n",arg, &L); + if ((n += L) > 50) { putchar('\n'); n = 0; } + } + } + if (n) putchar('\n'); + } + (void)printf("# projection parameters\n"); + pj_pr_list(P); + if (low.u == upp.u || low.v >= upp.v) + emess(16,"approx. argument range error"); + if (low.u > upp.u) + low.u -= TWOPI; + if (NU < 2 || NV < 2) + emess(16,"approx. work dimensions (%d %d) too small",NU,NV); + if (!(F = mk_cheby(low, upp, pow(10., (double)res)*.5, &resid, proj, + NU, NV, pwr))) + emess(16,"generation of approx failed\nreason: %s\n", + pj_strerrno(errno)); + (void)printf("%c,%.12g,%.12g,%.12g,%.12g,%.12g\n",inverse?'I':'F', + P->lam0*RAD_TO_DEG, + low.u*(inverse?1.:RAD_TO_DEG),upp.u*(inverse?1.:RAD_TO_DEG), + low.v*(inverse?1.:RAD_TO_DEG),upp.v*(inverse?1.:RAD_TO_DEG)); + if (pwr) + strcpy(fmt, "%.15g"); + else if (res <= 0) + (void)sprintf(fmt,"%%.%df",-res+1); + else + (void)strcpy(fmt,"%.0f"); + p_series(F, stdout, fmt); + (void)printf("# |u,v| sums %g %g\n#end_proj_%s\n", + resid.u, resid.v, pwr ? "Power" : "Chebyshev"); +} diff --git a/src/geod.c b/src/geod.c new file mode 100644 index 00000000..3be15024 --- /dev/null +++ b/src/geod.c @@ -0,0 +1,242 @@ +#ifndef lint +static const char SCCSID[]="@(#)geod.c 4.8 95/09/23 GIE REL"; +#endif +/* <<<< Geodesic filter program >>>> */ +# include "projects.h" +# include <stdio.h> +# include "geodesic.h" +# include "emess.h" +# include <ctype.h> +# include <string.h> + +# define MAXLINE 200 +# define MAX_PARGS 50 +# define TAB putchar('\t') + static int +fullout = 0, /* output full set of geodesic values */ +tag = '#', /* beginning of line tag character */ +pos_azi = 0, /* output azimuths as positive values */ +inverse = 0; /* != 0 then inverse geodesic */ + static char +*oform = (char *)0, /* output format for decimal degrees */ +*osform = "%.3f", /* output format for S */ +pline[50], /* work string */ +*usage = +"%s\nusage: %s [ -afFIptTwW [args] ] [ +opts[=arg] ] [ files ]\n"; + static void +printLL(double p, double l) { + if (oform) { + (void)printf(oform, p * RAD_TO_DEG); TAB; + (void)printf(oform, l * RAD_TO_DEG); + } else { + (void)fputs(rtodms(pline, p, 'N', 'S'),stdout); TAB; + (void)fputs(rtodms(pline, l, 'E', 'W'),stdout); + } +} + static void +do_arc(void) { + double az; + + printLL(phi2, lam2); putchar('\n'); + for (az = al12; n_alpha--; ) { + al12 = az = adjlon(az + del_alpha); + geod_pre(); + geod_for(); + printLL(phi2, lam2); putchar('\n'); + } +} + static void /* generate intermediate geodesic coordinates */ +do_geod(void) { + double phil, laml, del_S; + + phil = phi2; + laml = lam2; + printLL(phi1, lam1); putchar('\n'); + for ( S = del_S = S / n_S; --n_S; S += del_S) { + geod_for(); + printLL(phi2, lam2); putchar('\n'); + } + printLL(phil, laml); putchar('\n'); +} + void static /* file processing function */ +process(FILE *fid) { + char line[MAXLINE+3], *s; + + for (;;) { + ++emess_dat.File_line; + if (!(s = fgets(line, MAXLINE, fid))) + break; + if (!strchr(s, '\n')) { /* overlong line */ + int c; + strcat(s, "\n"); + /* gobble up to newline */ + while ((c = fgetc(fid)) != EOF && c != '\n') ; + } + if (*s == tag) { + fputs(line, stdout); + continue; + } + phi1 = dmstor(s, &s); + lam1 = dmstor(s, &s); + if (inverse) { + phi2 = dmstor(s, &s); + lam2 = dmstor(s, &s); + geod_inv(); + } else { + al12 = dmstor(s, &s); + S = strtod(s, &s) * to_meter; + geod_pre(); + geod_for(); + } + if (!*s && (s > line)) --s; /* assumed we gobbled \n */ + if (pos_azi) { + if (al12 < 0.) al12 += TWOPI; + if (al21 < 0.) al21 += TWOPI; + } + if (fullout) { + printLL(phi1, lam1); TAB; + printLL(phi2, lam2); TAB; + if (oform) { + (void)printf(oform, al12 * RAD_TO_DEG); TAB; + (void)printf(oform, al21 * RAD_TO_DEG); TAB; + (void)printf(osform, S * fr_meter); + } else { + (void)fputs(rtodms(pline, al12, 0, 0), stdout); TAB; + (void)fputs(rtodms(pline, al21, 0, 0), stdout); TAB; + (void)printf(osform, S * fr_meter); + } + } else if (inverse) + if (oform) { + (void)printf(oform, al12 * RAD_TO_DEG); TAB; + (void)printf(oform, al21 * RAD_TO_DEG); TAB; + (void)printf(osform, S * fr_meter); + } else { + (void)fputs(rtodms(pline, al12, 0, 0), stdout); TAB; + (void)fputs(rtodms(pline, al21, 0, 0), stdout); TAB; + (void)printf(osform, S * fr_meter); + } + else { + printLL(phi2, lam2); TAB; + if (oform) + (void)printf(oform, al21 * RAD_TO_DEG); + else + (void)fputs(rtodms(pline, al21, 0, 0), stdout); + } + (void)fputs(s, stdout); + } +} + static char +*pargv[MAX_PARGS]; + static int +pargc = 0; + void +main(int argc, char **argv) { + char *arg, **eargv = argv, *strnchr(); + FILE *fid; + static int eargc = 0, c; + + if (emess_dat.Prog_name = strrchr(*argv,'/')) ++emess_dat.Prog_name; + else emess_dat.Prog_name = *argv; + inverse = ! strncmp(emess_dat.Prog_name, "inv", 3); + if (argc <= 1 ) { + (void)fprintf(stderr, usage, pj_release, emess_dat.Prog_name); + exit (0); + } + /* process run line arguments */ + while (--argc > 0) { /* collect run line arguments */ + if(**++argv == '-') for(arg = *argv;;) { + switch(*++arg) { + case '\0': /* position of "stdin" */ + if (arg[-1] == '-') eargv[eargc++] = "-"; + break; + case 'a': /* output full set of values */ + fullout = 1; + continue; + case 'I': /* alt. inverse spec. */ + inverse = 1; + continue; + case 't': /* set col. one char */ + if (arg[1]) tag = *++arg; + else emess(1,"missing -t col. 1 tag"); + continue; + case 'W': /* specify seconds precision */ + case 'w': /* -W for constant field width */ + if ((c = arg[1]) && isdigit(c)) { + set_rtodms(c - '0', *arg == 'W'); + ++arg; + } else + emess(1,"-W argument missing or non-digit"); + continue; + case 'f': /* alternate output format degrees or xy */ + if (--argc <= 0) +noargument: emess(1,"missing argument for -%c",*arg); + oform = *++argv; + continue; + case 'F': /* alternate output format degrees or xy */ + if (--argc <= 0) goto noargument; + osform = *++argv; + continue; + case 'l': + if (!arg[1] || arg[1] == 'e') { /* list of ellipsoids */ + struct PJ_ELLPS *le; + + for (le = pj_ellps; le->id ; ++le) + (void)printf("%9s %-16s %-16s %s\n", + le->id, le->major, le->ell, le->name); + emess(1,"invalid list option: l%c",arg[1]); + emess(1,"-l[p|e] terminates program"); + } else if (arg[1] == 'u') { /* list of units */ + struct PJ_UNITS *lu; + + for (lu = pj_units; lu->id ; ++lu) + (void)printf("%12s %-20s %s\n", + lu->id, lu->to_meter, lu->name); + } else + emess(1,"invalid list option: l%c",arg[1]); + emess(1,"will not proceed after display list option"); + case 'p': /* output azimuths as positive */ + pos_azi = 1; + continue; + default: + emess(1, "invalid option: -%c",*arg); + break; + } + break; + } else if (**argv == '+') /* + argument */ + if (pargc < MAX_PARGS) + pargv[pargc++] = *argv + 1; + else + emess(1,"overflowed + argument table"); + else /* assumed to be input file name(s) */ + eargv[eargc++] = *argv; + } + /* done with parameter and control input */ + geod_set(pargc, pargv); /* setup projection */ + if ((n_alpha || n_S) && eargc) + emess(1,"files specified for arc/geodesic mode"); + if (n_alpha) + do_arc(); + else if (n_S) + do_geod(); + else { /* process input file list */ + if (eargc == 0) /* if no specific files force sysin */ + eargv[eargc++] = "-"; + for ( ; eargc-- ; ++eargv) { + if (**eargv == '-') { + fid = stdin; + emess_dat.File_name = "<stdin>"; + } else { + if ((fid = fopen(*eargv, "r")) == NULL) { + emess(-2, *eargv, "input file"); + continue; + } + emess_dat.File_name = *eargv; + } + emess_dat.File_line = 0; + process(fid); + (void)fclose(fid); + emess_dat.File_name = (char *)0; + } + } + exit(0); /* normal completion */ +} diff --git a/src/geod_for.c b/src/geod_for.c new file mode 100644 index 00000000..3411f0f5 --- /dev/null +++ b/src/geod_for.c @@ -0,0 +1,106 @@ +#ifndef lint +static const char SCCSID[]="@(#)geod_for.c 4.6 95/09/23 GIE REL"; +#endif +# include "projects.h" +# include "geodesic.h" +# define MERI_TOL 1e-9 + static double +th1,costh1,sinth1,sina12,cosa12,M,N,c1,c2,D,P,s1; + static int +merid, signS; + void +geod_pre(void) { + al12 = adjlon(al12); /* reduce to +- 0-PI */ + signS = fabs(al12) > HALFPI ? 1 : 0; + th1 = ellipse ? atan(onef * tan(phi1)) : phi1; + costh1 = cos(th1); + sinth1 = sin(th1); + if ((merid = fabs(sina12 = sin(al12)) < MERI_TOL)) { + sina12 = 0.; + cosa12 = fabs(al12) < HALFPI ? 1. : -1.; + M = 0.; + } else { + cosa12 = cos(al12); + M = costh1 * sina12; + } + N = costh1 * cosa12; + if (ellipse) { + if (merid) { + c1 = 0.; + c2 = f4; + D = 1. - c2; + D *= D; + P = c2 / D; + } else { + c1 = f * M; + c2 = f4 * (1. - M * M); + D = (1. - c2)*(1. - c2 - c1 * M); + P = (1. + .5 * c1 * M) * c2 / D; + } + } + if (merid) s1 = HALFPI - th1; + else { + s1 = (fabs(M) >= 1.) ? 0. : acos(M); + s1 = sinth1 / sin(s1); + s1 = (fabs(s1) >= 1.) ? 0. : acos(s1); + } +} + void +geod_for(void) { + double d,sind,u,V,X,ds,cosds,sinds,ss,de; + + if (ellipse) { + d = S / (D * a); + if (signS) d = -d; + u = 2. * (s1 - d); + V = cos(u + d); + X = c2 * c2 * (sind = sin(d)) * cos(d) * (2. * V * V - 1.); + ds = d + X - 2. * P * V * (1. - 2. * P * cos(u)) * sind; + ss = s1 + s1 - ds; + } else { + ds = S / a; + if (signS) ds = - ds; + } + cosds = cos(ds); + sinds = sin(ds); + if (signS) sinds = - sinds; + al21 = N * cosds - sinth1 * sinds; + if (merid) { + phi2 = atan( tan(HALFPI + s1 - ds) / onef); + if (al21 > 0.) { + al21 = PI; + if (signS) + de = PI; + else { + phi2 = - phi2; + de = 0.; + } + } else { + al21 = 0.; + if (signS) { + phi2 = - phi2; + de = 0; + } else + de = PI; + } + } else { + al21 = atan(M / al21); + if (al21 > 0) + al21 += PI; + if (al12 < 0.) + al21 -= PI; + al21 = adjlon(al21); + phi2 = atan(-(sinth1 * cosds + N * sinds) * sin(al21) / + (ellipse ? onef * M : M)); + de = atan2(sinds * sina12 , + (costh1 * cosds - sinth1 * sinds * cosa12)); + if (ellipse) + if (signS) + de += c1 * ((1. - c2) * ds + + c2 * sinds * cos(ss)); + else + de -= c1 * ((1. - c2) * ds - + c2 * sinds * cos(ss)); + } + lam2 = adjlon( lam1 + de ); +} diff --git a/src/geod_inv.c b/src/geod_inv.c new file mode 100644 index 00000000..f41d58af --- /dev/null +++ b/src/geod_inv.c @@ -0,0 +1,59 @@ +#ifndef lint +static const char SCCSID[]="@(#)geod_inv.c 4.5 95/09/23 GIE REL"; +#endif +# include "projects.h" +# include "geodesic.h" +# define DTOL 1e-12 + void +geod_inv(void) { + double th1,th2,thm,dthm,dlamm,dlam,sindlamm,costhm,sinthm,cosdthm, + sindthm,L,E,cosd,d,X,Y,T,sind,tandlammp,u,v,D,A,B; + + if (ellipse) { + th1 = atan(onef * tan(phi1)); + th2 = atan(onef * tan(phi2)); + } else { + th1 = phi1; + th2 = phi2; + } + thm = .5 * (th1 + th2); + dthm = .5 * (th2 - th1); + dlamm = .5 * ( dlam = adjlon(lam2 - lam1) ); + if (fabs(dlam) < DTOL && fabs(dthm) < DTOL) { + al12 = al21 = S = 0.; + return; + } + sindlamm = sin(dlamm); + costhm = cos(thm); sinthm = sin(thm); + cosdthm = cos(dthm); sindthm = sin(dthm); + L = sindthm * sindthm + (cosdthm * cosdthm - sinthm * sinthm) + * sindlamm * sindlamm; + d = acos(cosd = 1 - L - L); + if (ellipse) { + E = cosd + cosd; + sind = sin( d ); + Y = sinthm * cosdthm; + Y *= (Y + Y) / (1. - L); + T = sindthm * costhm; + T *= (T + T) / L; + X = Y + T; + Y -= T; + T = d / sind; + D = 4. * T * T; + A = D * E; + B = D + D; + S = a * sind * (T - f4 * (T * X - Y) + + f64 * (X * (A + (T - .5 * (A - E)) * X) - + Y * (B + E * Y) + D * X * Y)); + tandlammp = tan(.5 * (dlam - .25 * (Y + Y - E * (4. - X)) * + (f2 * T + f64 * (32. * T - (20. * T - A) + * X - (B + 4.) * Y)) * tan(dlam))); + } else { + S = a * d; + tandlammp = tan(dlamm); + } + u = atan2(sindthm , (tandlammp * costhm)); + v = atan2(cosdthm , (tandlammp * sinthm)); + al12 = adjlon(TWOPI + v - u); + al21 = adjlon(TWOPI - v - u); +} diff --git a/src/geod_set.c b/src/geod_set.c new file mode 100644 index 00000000..76cea729 --- /dev/null +++ b/src/geod_set.c @@ -0,0 +1,72 @@ +#ifndef lint +static const char SCCSID[]="@(#)geod_set.c 4.8 95/09/23 GIE REL"; +#endif +#include "projects.h" +#include "geodesic.h" + void +geod_set(int argc, char **argv) { + paralist *start = 0, *curr; + double es; + char *name; + int i; + + /* put arguments into internal linked list */ + if (argc <= 0) + emess(1, "no arguments in initialization list"); + for (i = 0; i < argc; ++i) + if (i) + curr = curr->next = pj_mkparam(argv[i]); + else + start = curr = pj_mkparam(argv[i]); + /* set elliptical parameters */ + if (pj_ell_set(start, &a, &es)) emess(1,"ellipse setup failure"); + /* set units */ + if (name = pj_param(start, "sunits").s) { + char *s; + + for (i = 0; (s = pj_units[i].id) && strcmp(name, s) ; ++i) ; + if (!s) + emess(1,"%s unknown unit conversion id", name); + fr_meter = 1. / (to_meter = atof(pj_units[i].to_meter)); + } else + to_meter = fr_meter = 1.; + if (ellipse = es != 0.) { + onef = sqrt(1. - es); + f = 1 - onef; + f2 = f/2; + f4 = f/4; + f64 = f*f/64; + } else { + onef = 1.; + f = f2 = f4 = f64 = 0.; + } + /* check if line or arc mode */ + if (pj_param(start, "tlat_1").i) { + double del_S; +#undef f + phi1 = pj_param(start, "rlat_1").f; + lam1 = pj_param(start, "rlon_1").f; + if (pj_param(start, "tlat_2").i) { + phi2 = pj_param(start, "rlat_2").f; + lam2 = pj_param(start, "rlon_2").f; + geod_inv(); + geod_pre(); + } else if (S = pj_param(start, "dS").f) { + al12 = pj_param(start, "rA").f; + geod_pre(); + geod_for(); + } else emess(1,"incomplete geodesic/arc info"); + if ((n_alpha = pj_param(start, "in_A").i) > 0) { + if (!(del_alpha = pj_param(start, "rdel_A").f)) + emess(1,"del azimuth == 0"); + } else if (del_S = fabs(pj_param(start, "ddel_S").f)) { + n_S = S / del_S + .5; + } else if ((n_S = pj_param(start, "in_S").i) <= 0) + emess(1,"no interval divisor selected"); + } + /* free up linked list */ + for ( ; start; start = curr) { + curr = start->next; + pj_dalloc(start); + } +} diff --git a/src/geodesic.h b/src/geodesic.h new file mode 100644 index 00000000..8454b222 --- /dev/null +++ b/src/geodesic.h @@ -0,0 +1,35 @@ +#ifndef lint +static char GEODESIC_H_ID[] = "@(#)geodesic.h 4.3 95/08/19 GIE REL"; +#endif +extern double dmstor(); +struct geodesic { + double A; + double LAM1, PHI1, ALPHA12; + double LAM2, PHI2, ALPHA21; + double DIST; + double ONEF, FLAT, FLAT2, FLAT4, FLAT64; + int ELLIPSE; +} GEODESIC; +# define a GEODESIC.A +# define lam1 GEODESIC.LAM1 +# define phi1 GEODESIC.PHI1 +# define al12 GEODESIC.ALPHA12 +# define lam2 GEODESIC.LAM2 +# define phi2 GEODESIC.PHI2 +# define al21 GEODESIC.ALPHA21 +# define S GEODESIC.DIST +# define f GEODESIC.FLAT +# define onef GEODESIC.ONEF +# define f2 GEODESIC.FLAT2 +# define f4 GEODESIC.FLAT4 +# define ff2 GEODESIC.FLAT4 +# define f64 GEODESIC.FLAT64 +# define ellipse GEODESIC.ELLIPSE + int +n_alpha, n_S; + double +to_meter, fr_meter, del_alpha; +void geod_set(int, char **); +void geod_for(void); +void geod_prefor(void); +void geod_inv(void); diff --git a/src/hypot.c b/src/hypot.c new file mode 100644 index 00000000..269c146b --- /dev/null +++ b/src/hypot.c @@ -0,0 +1,39 @@ +#ifndef lint +static const char SCCSID[]="@(#)hypot.c 4.4 93/06/12 GIE REL"; +#endif +/* hypot - sqrt(x * x + y * y) +** +** Because this was omitted from the ANSI standards, this version +** is included for those systems that do not include hypot as an +** extension to libm.a. Note: GNU version was not used because it +** was not properly coded to minimize potential overflow. +** +** The proper technique for determining hypot is to factor out the +** larger of the two terms, thus leaving a possible case of float +** overflow when max(x,y)*sqrt(2) > max machine value. This allows +** a wider range of numbers than the alternative of the sum of the +** squares < max machine value. For an Intel x87 IEEE double of +** approximately 1.8e308, only argument values > 1.27e308 are at +** risk of causing overflow. Whereas, not using this method limits +** the range to values less that 9.5e153 --- a considerable reduction +** in range! +*/ +extern double sqrt(double); + double +hypot(double x, double y) { + if ( x < 0.) + x = -x; + else if (x == 0.) + return (y < 0. ? -y : y); + if (y < 0.) + y = -y; + else if (y == 0.) + return (x); + if ( x < y ) { + x /= y; + return ( y * sqrt( 1. + x * x ) ); + } else { + y /= x; + return ( x * sqrt( 1. + y * y ) ); + } +} diff --git a/src/mk_cheby.c b/src/mk_cheby.c new file mode 100644 index 00000000..65b47890 --- /dev/null +++ b/src/mk_cheby.c @@ -0,0 +1,164 @@ +#ifndef lint +static const char SCCSID[]="@(#)mk_cheby.c 4.5 94/03/22 GIE REL"; +#endif +#include <projects.h> + static void /* sum coefficients less than res */ +eval(UV **w, int nu, int nv, double res, UV *resid) { + int i, j; + double ab; + UV *s; + + resid->u = resid->v = 0.; + for (i = 0; i < nu; ++i) + for (s = w[i], j = 0; j < nv; ++j, ++s) { + if ((ab = fabs(s->u)) < res) + resid->u += ab; + if ((ab = fabs(s->v)) < res) + resid->v += ab; + } +} + static Tseries * /* create power series structure */ +makeT(int nru, int nrv) { + Tseries *T; + int i; + + if ((T = (Tseries *)pj_malloc(sizeof(Tseries))) && + (T->cu = (struct PW_COEF *)pj_malloc( + sizeof(struct PW_COEF) * nru)) && + (T->cv = (struct PW_COEF *)pj_malloc( + sizeof(struct PW_COEF) * nrv))) { + for (i = 0; i < nru; ++i) + T->cu[i].c = 0; + for (i = 0; i < nrv; ++i) + T->cv[i].c = 0; + return T; + } else + return 0; +} + Tseries * +mk_cheby(UV a, UV b, double res, UV *resid, UV (*func)(UV), + int nu, int nv, int power) { + int j, i, nru, nrv, *ncu, *ncv; + Tseries *T; + UV **w; + double cutres; + + if (!(w = (UV **)vector2(nu, nv, sizeof(UV))) || + !(ncu = (int *)vector1(nu + nv, sizeof(int)))) + return 0; + ncv = ncu + nu; + if (!bchgen(a, b, nu, nv, w, func)) { + UV *s; + double ab, *p; + + /* analyse coefficients and adjust until residual OK */ + cutres = res; + for (i = 4; i ; --i) { + eval(w, nu, nv, cutres, resid); + if (resid->u < res && resid->v < res) + break; + cutres *= 0.5; + } + if (i <= 0) /* warn of too many tries */ + resid->u = - resid->u; + /* apply cut resolution and set pointers */ + nru = nrv = 0; + for (j = 0; j < nu; ++j) { + ncu[j] = ncv[j] = 0; /* clear column maxes */ + for (s = w[j], i = 0; i < nv; ++i, ++s) { + if ((ab = fabs(s->u)) < cutres) /* < resolution ? */ + s->u = 0.; /* clear coefficient */ + else + ncu[j] = i + 1; /* update column max */ + if ((ab = fabs(s->v)) < cutres) /* same for v coef's */ + s->v = 0.; + else + ncv[j] = i + 1; + } + if (ncu[j]) nru = j + 1; /* update row max */ + if (ncv[j]) nrv = j + 1; + } + if (power) { /* convert to bivariate power series */ + if (!bch2bps(a, b, w, nu, nv)) + goto error; + /* possible change in some row counts, so readjust */ + nru = nrv = 0; + for (j = 0; j < nu; ++j) { + ncu[j] = ncv[j] = 0; /* clear column maxes */ + for (s = w[j], i = 0; i < nv; ++i, ++s) { + if (s->u) + ncu[j] = i + 1; /* update column max */ + if (s->v) + ncv[j] = i + 1; + } + if (ncu[j]) nru = j + 1; /* update row max */ + if (ncv[j]) nrv = j + 1; + } + if (T = makeT(nru, nrv)) { + T->a = a; + T->b = b; + T->mu = nru - 1; + T->mv = nrv - 1; + T->power = 1; + for (i = 0; i < nru; ++i) /* store coefficient rows for u */ + if (T->cu[i].m = ncu[i]) + if ((p = T->cu[i].c = + (double *)pj_malloc(sizeof(double) * ncu[i]))) + for (j = 0; j < ncu[i]; ++j) + *p++ = (w[i] + j)->u; + else + goto error; + for (i = 0; i < nrv; ++i) /* same for v */ + if (T->cv[i].m = ncv[i]) + if ((p = T->cv[i].c = + (double *)pj_malloc(sizeof(double) * ncv[i]))) + for (j = 0; j < ncv[i]; ++j) + *p++ = (w[i] + j)->v; + else + goto error; + } + } else if (T = makeT(nru, nrv)) { + /* else make returned Chebyshev coefficient structure */ + T->mu = nru - 1; /* save row degree */ + T->mv = nrv - 1; + T->a.u = a.u + b.u; /* set argument scaling */ + T->a.v = a.v + b.v; + T->b.u = 1. / (b.u - a.u); + T->b.v = 1. / (b.v - a.v); + T->power = 0; + for (i = 0; i < nru; ++i) /* store coefficient rows for u */ + if (T->cu[i].m = ncu[i]) + if ((p = T->cu[i].c = + (double *)pj_malloc(sizeof(double) * ncu[i]))) + for (j = 0; j < ncu[i]; ++j) + *p++ = (w[i] + j)->u; + else + goto error; + for (i = 0; i < nrv; ++i) /* same for v */ + if (T->cv[i].m = ncv[i]) + if ((p = T->cv[i].c = + (double *)pj_malloc(sizeof(double) * ncv[i]))) + for (j = 0; j < ncv[i]; ++j) + *p++ = (w[i] + j)->v; + else + goto error; + } else + goto error; + } + goto gohome; +error: + if (T) { /* pj_dalloc up possible allocations */ + for (i = 0; i <= T->mu; ++i) + if (T->cu[i].c) + pj_dalloc(T->cu[i].c); + for (i = 0; i <= T->mv; ++i) + if (T->cv[i].c) + pj_dalloc(T->cv[i].c); + pj_dalloc(T); + } + T = 0; +gohome: + freev2(w, nu); + pj_dalloc(ncu); + return T; +} diff --git a/src/nad2bin.c b/src/nad2bin.c new file mode 100644 index 00000000..3cf5c34e --- /dev/null +++ b/src/nad2bin.c @@ -0,0 +1,68 @@ +/* Convert bivariate ASCII NAD27 to NAD83 tables to binary structure */ +#ifndef lint +static const char SCCSID[]="@(#)nad2bin.c 4.2 93/08/25 GIE REL"; +#endif +#include <stdio.h> +#include <stdlib.h> +#define PJ_LIB__ +#include <projects.h> +#define U_SEC_TO_RAD 4.848136811095359935899141023e-12 + static char +*usage = "<ASCII_dist_table local_bin_table"; + void +main(int argc, char **argv) { + struct CTABLE ct; + FLP *p, t; + size_t tsize; + int i, j, ichk; + long lam, laml, phi, phil; + FILE *bin; + + if (argc != 2) { + fprintf(stderr,"usage: %s %s\n", argv[0], usage); + exit(1); + } + fgets(ct.id, MAX_TAB_ID, stdin); + scanf("%d %d %*d %lf %lf %lf %lf", &ct.lim.lam, &ct.lim.phi, + &ct.ll.lam, &ct.del.lam, &ct.ll.phi, &ct.del.phi); + if (!(ct.cvs = (FLP *)malloc(tsize = ct.lim.lam * ct.lim.phi * + sizeof(FLP)))) { + perror("mem. alloc"); + exit(1); + } + ct.ll.lam *= DEG_TO_RAD; + ct.ll.phi *= DEG_TO_RAD; + ct.del.lam *= DEG_TO_RAD; + ct.del.phi *= DEG_TO_RAD; + /* load table */ + for (p = ct.cvs, i = 0; i < ct.lim.phi; ++i) { + scanf("%d:%ld %ld", &ichk, &laml, &phil); + if (ichk != i) { + fprintf(stderr,"format check on row\n"); + exit(1); + } + t.lam = laml * U_SEC_TO_RAD; + t.phi = phil * U_SEC_TO_RAD; + *p++ = t; + for (j = 1; j < ct.lim.lam; ++j) { + scanf("%ld %ld", &lam, &phi); + t.lam = (laml += lam) * U_SEC_TO_RAD; + t.phi = (phil += phi) * U_SEC_TO_RAD; + *p++ = t; + } + } + if (feof(stdin)) { + fprintf(stderr, "premature EOF\n"); + exit(1); + } + if (!(bin = freopen(argv[1], "wb", stdout))) { + perror(argv[1]); + exit(2); + } + if (fwrite(&ct, sizeof(ct), 1, stdout) != 1 || + fwrite(ct.cvs, tsize, 1, stdout) != 1) { + fprintf(stderr, "output failure\n"); + exit(2); + } + exit(0); /* normal completion */ +} diff --git a/src/nad2nad.c b/src/nad2nad.c new file mode 100644 index 00000000..210854e6 --- /dev/null +++ b/src/nad2nad.c @@ -0,0 +1,313 @@ +/* <<<< North American Datum Transfer Program >>>> */ +#ifndef lint +static const char SCCSID[]="@(#)nad2nad.c 4.5 94/02/15 GIE REL"; +#endif +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#define PJ_LIST_H <nad_list.h> +#include <projects.h> +#include "emess.h" + +#define MAX_LINE 200 +#define MAX_PARGS 100 +#define PJ_INVERS(P) (P->inv ? 1 : 0) + static int +echoin = 0, /* echo input data to output line */ +tag = '#'; /* beginning of line tag character */ + static char +*oform = (char *)0, /* output format for x-y or decimal degrees */ +*oterr = "*\t*", /* output line for unprojectable input */ +*inargs = 0, +*outargs = 0, +*czone = 0, +*usage = +"%s\nusage: %s [ -eEfihortwW [args] ] [ files ]\n"; + struct CTABLE +*ctab = 0, +*htab = 0; +static struct TAG_LIST { + char *tag; + short sw; +} ops_list[] = { + "utm=", 0, + "spcs=", 1, + "feet", 2, + "27", 3, + "83", 4, + "hp", 5, + "bin", 6, + "rev", 7, + 0, 0, +}; +static struct IO_CON { + short rev; /* reverse lon/lat or x/y */ + short bin; /* io binary */ + short ll; /* io lat-lon */ + short t83; /* data in 83 datum */ + short zone; /* <100 utm zone, ==0 geog, else state plane zone */ + short nprojc; /* number of entries in projc */ + char *hp; /* high precision name */ + char *projc[10]; /* params for pj_init */ + PJ *cnv; +} input = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}, output = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + static void +set_zone(int in, struct IO_CON *io) { + char tmp[20]; + + if (io->hp) { + io->t83 = 1; + if (!(htab = nad_init(io->hp))) + emess(1,"hp datum file: %s, failed: %s", io->hp, + pj_strerrno(pj_errno)); + } + if (io->zone > 0) { + if (io->zone <= 60) { /* UTM zone */ + io->nprojc = 2; /* no other options allowed */ + io->projc[0] = "proj=utm"; + sprintf(tmp, "zone=%d", io->zone); + io->projc[1] = io->t83 ? "ellps=GRS80" : "ellps=clrk66"; + } else /* SPCS zone */ + sprintf(tmp, "init=nad%s:%d", io->t83 ? "83" : "27", io->zone); + io->projc[io->nprojc++] = tmp; + io->projc[io->nprojc++] = "no_defs"; + if (!(io->cnv = pj_init(io->nprojc, io->projc))) + emess(1,pj_strerrno(pj_errno)); + io->ll = 0; + } +} + static void +setup() { + /* check and set zone operations */ + if (input.hp && output.hp) + emess(1,"both input and output cannot be high precision"); + set_zone(1, &input); + set_zone(0, &output); + if (input.cnv && !output.cnv) + output.ll = 1; + if (output.cnv && !input.cnv) + input.ll = 1; + if (!input.cnv && !output.cnv) + output.ll = input.ll = 1; + if (czone) { + if (!input.hp && !output.hp && input.t83 == output.t83) + emess(1,"identical datums"); + if (!(ctab = nad_init(czone))) + emess(1,"datum file: %s, failed: %s", czone, pj_strerrno(pj_errno)); + } else if (input.t83 != output.t83) + emess(1,"conversion region (-r) not specified"); +} + static void +set_ops(char *s, struct IO_CON *io) { + char *intag; + struct TAG_LIST *p; + + for ( ; intag = strtok(s, " ,\t"); s = 0) { + for (p = ops_list; p->tag; ++p) { + if (!strncmp(intag, p->tag, strlen(p->tag))) + break; + } + if (!p->tag) + emess(1,"invalid selection"); + switch (p->sw) { + case 0: + case 1: + s = strchr(intag, '=') + 1; + io->zone = atoi(s); + break; + case 2: + if (io->zone <= 60) + emess(1,"spcs zone must be selected"); + io->projc[io->nprojc++] = "units=us-ft"; + break; + case 3: io->t83 = 0; break; + case 4: io->t83 = 1; break; + case 5: + if (!(intag = strchr(intag, '=')) || *++intag == '\0') + emess(1,"hp missing name"); + strcpy(io->hp = malloc(strlen(intag)+1), intag); + break; + case 6: io->bin = 1; break; + case 7: io->rev = 1; break; + } + } +} + static void +process(FILE *fid) { + char line[MAX_LINE], *s, t, pline[100]; + UV val; + double tmp; + + for (;;) { + if (input.bin) + fread(&val, sizeof(UV), 1, fid); + else if (s = fgets(line, MAX_LINE, fid)) { + if (*s == tag) { + fputs(line, stdout); + continue; + } else if (input.ll) { + val.u = dmstor(s, &s); + val.v = dmstor(s, &s); + } else { + val.u = strtod(s, &s); + val.v = strtod(s, &s); + } + } + if (feof(fid)) + break; + if (input.rev) { + tmp = val.u; + val.u = val.v; + val.v = tmp; + } + /* data in, manupulate */ + if (input.cnv) + val = pj_inv(val, input.cnv); + if (input.hp) + val = nad_cvt(val, 1, htab); + /* nad conversion */ + if (ctab) + val = nad_cvt(val, input.t83 ? 1 : 0, ctab); + if (output.hp) + val = nad_cvt(val, 0, htab); + if (output.cnv) + val = pj_fwd(val, output.cnv); + /* output data */ + if (output.rev) { + tmp = val.u; + val.u = val.v; + val.v = tmp; + } + if (output.bin) + (void)fwrite(&val, sizeof(UV), 1, stdout); + else { + if (echoin) { + t = *s; + *s = '\0'; + (void)fputs(line, stdout); + (void)putchar('\t'); + *s = t; + } + if (val.u == HUGE_VAL) + (void)fputs(oterr, stdout); + else if (output.ll) + if (oform) { + (void)printf(oform, val.u * RAD_TO_DEG); + (void)putchar('\t'); + (void)printf(oform, val.v * RAD_TO_DEG); + } else if (output.rev) { + (void)fputs(rtodms(pline, val.u, 'N', 'S'), stdout); + (void)putchar('\t'); + (void)fputs(rtodms(pline, val.v, 'E', 'W'), stdout); + } else { + (void)fputs(rtodms(pline, val.u, 'E', 'W'), stdout); + (void)putchar('\t'); + (void)fputs(rtodms(pline, val.v, 'N', 'S'), stdout); + } + else { + (void)printf(oform ? oform : "%.2f", val.u); + (void)putchar('\t'); + (void)printf(oform ? oform : "%.2f", val.v); + } + if (input.bin) + putchar('\n'); + else + (void)fputs(s, stdout); + } + } +} + void +main(int argc, char **argv) { + char *arg, **eargv = argv, work[MAX_PARGS]; + FILE *fid; + int eargc = 0, c; + + if (emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) + ++emess_dat.Prog_name; + else emess_dat.Prog_name = *argv; + if (argc <= 1 ) { + (void)fprintf(stderr, usage, pj_release, emess_dat.Prog_name); + exit (0); + } + /* process run line arguments */ + while (--argc > 0) { /* collect run line arguments */ + if(**++argv == '-') for(arg = *argv;;) { + switch(*++arg) { + case '\0': /* position of "stdin" */ + if (arg[-1] == '-') eargv[eargc++] = "-"; + break; + case 'i': /* input control */ + case 'o': /* output control */ + if (--argc <= 0) goto noargument; + strncpy(work, *++argv, MAX_PARGS); + set_ops(work, *arg == 'i' ? &input : &output); + continue; + case 'r': /* nad27/83 conversion zone */ + if (--argc <= 0) goto noargument; + czone = *++argv; + continue; + case 'E': /* echo ascii input to ascii output */ + echoin = 1; + continue; + case 't': /* set col. one char */ + if (arg[1]) tag = *++arg; + else emess(1,"missing -t col. 1 tag"); + continue; + case 'W': /* specify seconds precision */ + case 'w': /* -W for constant field width */ + if ((c = arg[1]) != 0 && isdigit(c)) { + set_rtodms(c - '0', *arg == 'W'); + ++arg; + } else + emess(1,"-W argument missing or non-digit"); + continue; + case 'f': /* alternate output format degrees or xy */ + if (--argc <= 0) goto noargument; + oform = *++argv; + continue; + case 'e': /* error line alternative */ + if (--argc <= 0) +noargument: emess(1,"missing argument for -%c",*arg); + oterr = *++argv; + continue; + default: + emess(1, "invalid option: -%c",*arg); + break; + } + break; + } else /* assumed to be input file name(s) */ + eargv[eargc++] = *argv; + } + if (eargc == 0) /* if no specific files force sysin */ + eargv[eargc++] = "-"; + /* done with parameter and control input */ + setup(); + /* process input file list */ + for ( ; eargc-- ; ++eargv) { + if (**eargv == '-') { + fid = stdin; + emess_dat.File_name = "<stdin>"; + } else { + if ((fid = fopen(*eargv, "r")) == NULL) { + emess(-2, *eargv, "input file"); + continue; + } + emess_dat.File_name = *eargv; + } + emess_dat.File_line = 0; + /* process file */ + process(fid); + (void)fclose(fid); + emess_dat.File_name = 0; + } + exit(0); /* normal completion */ +} diff --git a/src/nad_cvt.c b/src/nad_cvt.c new file mode 100644 index 00000000..600ea3cd --- /dev/null +++ b/src/nad_cvt.c @@ -0,0 +1,49 @@ +#ifndef lint +static const char SCCSID[]="@(#)nad_cvt.c 4.3 95/09/23 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#define MAX_TRY 9 +#define TOL 1e-12 + LP +nad_cvt(LP in, int inverse, struct CTABLE *ct) { + LP t, tb; + + if (in.lam == HUGE_VAL) + return in; + /* normalize input to ll origin */ + tb = in; + tb.lam -= ct->ll.lam; + tb.phi -= ct->ll.phi; + tb.lam = adjlon(tb.lam); + t = nad_intr(tb, ct); + if (inverse) { + LP del, dif; + int i = MAX_TRY; + + if (t.lam == HUGE_VAL) return t; + t.lam = tb.lam + t.lam; + t.phi = tb.phi - t.phi; + + do { + del = nad_intr(t, ct); + if (del.lam == HUGE_VAL) return del; + t.lam -= dif.lam = t.lam - del.lam - tb.lam; + t.phi -= dif.phi = t.phi + del.phi - tb.phi; + } while (i-- && fabs(dif.lam) > TOL && fabs(dif.phi) > TOL); + if (i < 0) { + t.lam = t.phi = HUGE_VAL; + return t; + } + in.lam = adjlon(t.lam + ct->ll.lam); + in.phi = t.phi + ct->ll.phi; + } else { + if (t.lam == HUGE_VAL) + in = t; + else { + in.lam -= t.lam; + in.phi += t.phi; + } + } + return in; +} diff --git a/src/nad_init.c b/src/nad_init.c new file mode 100644 index 00000000..ed3b6273 --- /dev/null +++ b/src/nad_init.c @@ -0,0 +1,43 @@ +/* open structure for NAD27<->NAD83 conversion */ +#ifndef lint +static const char SCCSID[]="@(#)nad_init.c 4.5 94/10/30 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#include <stdio.h> +#include <errno.h> +extern FILE *pj_open_lib(char *, char *); + struct CTABLE * +nad_init(char *name) { + char fname[MAX_PATH_FILENAME+1]; + struct CTABLE *ct; + FILE *fid; + size_t i; + + errno = pj_errno = 0; + strcpy(fname, "nad2783/"); + strcat(fname, name); + if (!(fid = pj_open_lib(fname, "rb"))) { + pj_errno = errno; + return 0; + } + if (!(ct = pj_malloc(sizeof(struct CTABLE))) || + fread(ct, sizeof(struct CTABLE), 1, fid) != 1 || + !(ct->cvs = (FLP *)pj_malloc(i=sizeof(FLP)*ct->lim.lam*ct->lim.phi)) || + fread(ct->cvs, i, 1, fid) != 1) { + nad_free(ct); + pj_errno = -38; + ct = 0; + return 0; + } + fclose(fid); + pj_errno = 0; + return ct; +} + void +nad_free(struct CTABLE *ct) { + if (ct) { + pj_dalloc(ct->cvs); + pj_dalloc(ct); + } +} diff --git a/src/nad_intr.c b/src/nad_intr.c new file mode 100644 index 00000000..8bf24419 --- /dev/null +++ b/src/nad_intr.c @@ -0,0 +1,65 @@ +/* Determine nad table correction value */ +#ifndef lint +static const char SCCSID[]="@(#)nad_intr.c 4.2 95/09/23 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> + LP +nad_intr(LP t, struct CTABLE *ct) { + LP val, frct; + ILP indx; + double m00, m10, m01, m11; + FLP *f00, *f10, *f01, *f11; + long index; + int in; + + indx.lam = floor(t.lam /= ct->del.lam); + indx.phi = floor(t.phi /= ct->del.phi); + frct.lam = t.lam - indx.lam; + frct.phi = t.phi - indx.phi; + val.lam = val.phi = HUGE_VAL; + if (indx.lam < 0) { + if (indx.lam == -1 && frct.lam > 0.99999999999) { + ++indx.lam; + frct.lam = 0.; + } else + return val; + } else if ((in = indx.lam + 1) >= ct->lim.lam) { + if (in == ct->lim.lam && frct.lam < 1e-11) { + --indx.lam; + frct.lam = 1.; + } else + return val; + } + if (indx.phi < 0) { + if (indx.phi == -1 && frct.phi > 0.99999999999) { + ++indx.phi; + frct.phi = 0.; + } else + return val; + } else if ((in = indx.phi + 1) >= ct->lim.phi) { + if (in == ct->lim.phi && frct.phi < 1e-11) { + --indx.phi; + frct.phi = 1.; + } else + return val; + } + index = indx.phi * ct->lim.lam + indx.lam; + f00 = ct->cvs + index++; + f10 = ct->cvs + index; + index += ct->lim.lam; + f11 = ct->cvs + index--; + f01 = ct->cvs + index; + m11 = m10 = frct.lam; + m00 = m01 = 1. - frct.lam; + m11 *= frct.phi; + m01 *= frct.phi; + frct.phi = 1. - frct.phi; + m00 *= frct.phi; + m10 *= frct.phi; + val.lam = m00 * f00->lam + m10 * f10->lam + + m01 * f01->lam + m11 * f11->lam; + val.phi = m00 * f00->phi + m10 * f10->phi + + m01 * f01->phi + m11 * f11->phi; + return val; +} diff --git a/src/nad_list.h b/src/nad_list.h new file mode 100644 index 00000000..f82a2ab7 --- /dev/null +++ b/src/nad_list.h @@ -0,0 +1,6 @@ +/* projection list for program nad2nad */ +PROJ_HEAD(lcc, "Lambert Conformal Conic") +PROJ_HEAD(omerc, "Oblique Mercator") +PROJ_HEAD(poly, "Polyconic (American)") +PROJ_HEAD(tmerc, "Transverse Mercator") +PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") diff --git a/src/p_series.c b/src/p_series.c new file mode 100644 index 00000000..7c16a23d --- /dev/null +++ b/src/p_series.c @@ -0,0 +1,42 @@ +/* print row coefficients of Tseries structure */ +#ifndef lint +static const char SCCSID[]="@(#)p_series.c 4.6 95/08/19 GIE REL"; +#endif +#include <stdio.h> +#include <string.h> +#include <projects.h> +#define NF 20 /* length of final format string */ +#define CUT 60 /* check length of line */ + void +p_series(Tseries *T, FILE *file, char *fmt) { + int i, j, n, L; + char format[NF+1]; + + *format = ' '; + strncpy(format + 1, fmt, NF - 3); + strcat(format, "%n"); + fprintf(file, "u: %d\n", T->mu+1); + for (i = 0; i <= T->mu; ++i) + if (T->cu[i].m) { + fprintf(file, "%d %d%n", i, T->cu[i].m, &L); + n = 0; + for (j = 0; j < T->cu[i].m; ++j) { + if ((L += n) > CUT) + fprintf(file, "\n %n", &L); + fprintf(file, format, T->cu[i].c[j], &n); + } + fputc('\n', file); + } + fprintf(file, "v: %d\n", T->mv+1); + for (i = 0; i <= T->mv; ++i) + if (T->cv[i].m) { + fprintf(file, "%d %d%n", i, T->cv[i].m, &L); + n = 0; + for (j = 0; j < T->cv[i].m; ++j) { + if ((L += n) > 60) + fprintf(file, "\n %n", &L); + fprintf(file, format, T->cv[i].c[j], &n); + } + fputc('\n', file); + } +} diff --git a/src/pj_auth.c b/src/pj_auth.c new file mode 100644 index 00000000..92ec339b --- /dev/null +++ b/src/pj_auth.c @@ -0,0 +1,33 @@ +/* determine latitude from authalic latitude */ +#ifndef lint +static const char SCCSID[]="@(#)pj_auth.c 4.3 93/06/12 GIE REL"; +#endif +#include <projects.h> +# define P00 .33333333333333333333 +# define P01 .17222222222222222222 +# define P02 .10257936507936507936 +# define P10 .06388888888888888888 +# define P11 .06640211640211640211 +# define P20 .01641501294219154443 +#define APA_SIZE 3 + double * +pj_authset(double es) { + double t, *APA; + + if (APA = (double *)pj_malloc(APA_SIZE * sizeof(double))) { + APA[0] = es * P00; + t = es * es; + APA[0] += t * P01; + APA[1] = t * P10; + t *= es; + APA[0] += t * P02; + APA[1] += t * P11; + APA[2] = t * P20; + } + return APA; +} + double +pj_authlat(double beta, double *APA) { + double t = beta+beta; + return(beta + APA[0] * sin(t) + APA[1] * sin(t+t) + APA[2] * sin(t+t+t)); +} diff --git a/src/pj_deriv.c b/src/pj_deriv.c new file mode 100644 index 00000000..f6477b08 --- /dev/null +++ b/src/pj_deriv.c @@ -0,0 +1,36 @@ +/* dervative of (*P->fwd) projection */ +#ifndef lint +static const char SCCSID[]="@(#)pj_deriv.c 4.4 93/06/12 GIE REL"; +#endif +#define PJ_LIB__ +#include "projects.h" + int +pj_deriv(LP lp, double h, PJ *P, struct DERIVS *der) { + XY t; + + lp.lam += h; + lp.phi += h; + if (fabs(lp.phi) > HALFPI) return 1; + h += h; + t = (*P->fwd)(lp, P); + if (t.x == HUGE_VAL) return 1; + der->x_l = t.x; der->y_p = t.y; der->x_p = -t.x; der->y_l = -t.y; + lp.phi -= h; + if (fabs(lp.phi) > HALFPI) return 1; + t = (*P->fwd)(lp, P); + if (t.x == HUGE_VAL) return 1; + der->x_l += t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l -= t.y; + lp.lam -= h; + t = (*P->fwd)(lp, P); + if (t.x == HUGE_VAL) return 1; + der->x_l -= t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l += t.y; + lp.phi += h; + t = (*P->fwd)(lp, P); + if (t.x == HUGE_VAL) return 1; + der->x_l -= t.x; der->y_p += t.y; der->x_p -= t.x; der->y_l += t.y; + der->x_l /= (h += h); + der->y_p /= h; + der->x_p /= h; + der->y_l /= h; + return 0; +} diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c new file mode 100644 index 00000000..7d220331 --- /dev/null +++ b/src/pj_ell_set.c @@ -0,0 +1,105 @@ +/* set ellipsoid parameters a and es */ +#ifndef lint +static const char SCCSID[]="@(#)pj_ell_set.c 4.5 93/06/12 GIE REL"; +#endif +#include <projects.h> +#include <string.h> +#define SIXTH .1666666666666666667 /* 1/6 */ +#define RA4 .04722222222222222222 /* 17/360 */ +#define RA6 .02215608465608465608 /* 67/3024 */ +#define RV4 .06944444444444444444 /* 5/72 */ +#define RV6 .04243827160493827160 /* 55/1296 */ + int /* initialize geographic shape parameters */ +pj_ell_set(paralist *pl, double *a, double *es) { + int i; + double b, e; + char *name; + paralist *start = 0, *curr; + + /* check for varying forms of ellipsoid input */ + *a = *es = 0.; + /* R takes precedence */ + if (pj_param(pl, "tR").i) + *a = pj_param(pl, "dR").f; + else { /* probable elliptical figure */ + + /* check if ellps present and temporarily append its values to pl */ + if (name = pj_param(pl, "sellps").s) { + char *s; + + for (start = pl; start && start->next ; start = start->next) ; + curr = start; + for (i = 0; (s = pj_ellps[i].id) && strcmp(name, s) ; ++i) ; + if (!s) { pj_errno = -9; return 1; } + curr = curr->next = pj_mkparam(pj_ellps[i].major); + curr = curr->next = pj_mkparam(pj_ellps[i].ell); + } + *a = pj_param(pl, "da").f; + if (pj_param(pl, "tes").i) /* eccentricity squared */ + *es = pj_param(pl, "des").f; + else if (pj_param(pl, "te").i) { /* eccentricity */ + e = pj_param(pl, "de").f; + *es = e * e; + } else if (pj_param(pl, "trf").i) { /* recip flattening */ + *es = pj_param(pl, "drf").f; + if (!*es) { + pj_errno = -10; + goto bomb; + } + *es = 1./ *es; + *es = *es * (2. - *es); + } else if (pj_param(pl, "tf").i) { /* flattening */ + *es = pj_param(pl, "df").f; + *es = *es * (2. - *es); + } else if (pj_param(pl, "tb").i) { /* minor axis */ + b = pj_param(pl, "db").f; + *es = 1. - (b * b) / (*a * *a); + } /* else *es == 0. and sphere of radius *a */ + if (!b) + b = *a * sqrt(1. - *es); + /* following options turn ellipsoid into equivalent sphere */ + if (pj_param(pl, "bR_A").i) { /* sphere--area of ellipsoid */ + *a *= 1. - *es * (SIXTH + *es * (RA4 + *es * RA6)); + *es = 0.; + } else if (pj_param(pl, "bR_V").i) { /* sphere--vol. of ellipsoid */ + *a *= 1. - *es * (SIXTH + *es * (RV4 + *es * RV6)); + *es = 0.; + } else if (pj_param(pl, "bR_a").i) { /* sphere--arithmetic mean */ + *a = .5 * (*a + b); + *es = 0.; + } else if (pj_param(pl, "bR_g").i) { /* sphere--geometric mean */ + *a = sqrt(*a * b); + *es = 0.; + } else if (pj_param(pl, "bR_h").i) { /* sphere--harmonic mean */ + *a = 2. * *a * b / (*a + b); + *es = 0.; + } else if ((i = pj_param(pl, "tR_lat_a").i) || /* sphere--arith. */ + pj_param(pl, "tR_lat_g").i) { /* or geom. mean at latitude */ + double tmp; + + tmp = sin(pj_param(pl, i ? "rR_lat_a" : "rR_lat_g").f); + if (fabs(tmp) > HALFPI) { + pj_errno = -11; + goto bomb; + } + tmp = 1. - *es * tmp * tmp; + *a *= i ? .5 * (1. - *es + tmp) / ( tmp * sqrt(tmp)) : + sqrt(1. - *es) / tmp; + *es = 0.; + } +bomb: + if (start) { /* clean up temporary extension of list */ + pj_dalloc(start->next->next); + pj_dalloc(start->next); + start->next = 0; + } + if (pj_errno) + return 1; + } + /* some remaining checks */ + if (*es < 0.) + { pj_errno = -12; return 1; } + if (*a <= 0.) + { pj_errno = -13; return 1; } + return 0; +} diff --git a/src/pj_ellps.c b/src/pj_ellps.c new file mode 100644 index 00000000..c26a9007 --- /dev/null +++ b/src/pj_ellps.c @@ -0,0 +1,51 @@ +/* definition of standard geoids */ +#ifndef lint +static const char SCCSID[]="@(#)pj_ellps.c 4.6 95/08/25 GIE REL"; +#endif +#define PJ_ELLPS__ +#include "projects.h" + struct PJ_ELLPS +pj_ellps[] = { +"MERIT", "a=6378137.0", "rf=298.257", "MERIT 1983", +"SGS85", "a=6378136.0", "rf=298.257", "Soviet Geodetic System 85", +"GRS80", "a=6378137.0", "rf=298.257222101", "GRS 1980(IUGG, 1980)", +"IAU76", "a=6378140.0", "rf=298.257", "IAU 1976", +"airy", "a=6377563.396", "b=6356256.910", "Airy 1830", +"APL4.9", "a=6378137.0.", "rf=298.25", "Appl. Physics. 1965", +"NWL9D", "a=6378145.0.", "rf=298.25", "Naval Weapons Lab., 1965", +"mod_airy", "a=6377340.189", "b=6356034.446", "Modified Airy", +"andrae", "a=6377104.43", "rf=300.0", "Andrae 1876 (Den., Iclnd.)", +"aust_SA", "a=6378160.0", "rf=298.25", "Australian Natl & S. Amer. 1969", +"GRS67", "a=6378160.0", "rf=298.2471674270", "GRS 67(IUGG 1967)", +"bessel", "a=6377397.155", "rf=299.1528128", "Bessel 1841", +"bess_nam", "a=6377483.865", "rf=299.1528128", "Bessel 1841 (Namibia)", +"clrk66", "a=6378206.4", "b=6356583.8", "Clarke 1866", +"clrk80", "a=6378249.145", "rf=293.4663", "Clarke 1880 mod.", +"CPM", "a=6375738.7", "rf=334.29", "Comm. des Poids et Mesures 1799", +"delmbr", "a=6376428.", "rf=311.5", "Delambre 1810 (Belgium)", +"engelis", "a=6378136.05", "rf=298.2566", "Engelis 1985", +"evrst30", "a=6377276.345", "rf=300.8017", "Everest 1830", +"evrst48", "a=6377304.063", "rf=300.8017", "Everest 1948", +"evrst56", "a=6377301.243", "rf=300.8017", "Everest 1956", +"evrst69", "a=6377295.664", "rf=300.8017", "Everest 1969", +"evrstSS", "a=6377298.556", "rf=300.8017", "Everest (Sabah & Sarawak)", +"fschr60", "a=6378166.", "rf=298.3", "Fischer (Mercury Datum) 1960", +"fschr60m", "a=6378155.", "rf=298.3", "Modified Fischer 1960", +"fschr68", "a=6378150.", "rf=298.3", "Fischer 1968", +"helmert", "a=6378200.", "rf=298.3", "Helmert 1906", +"hough", "a=6378270.0", "rf=297.", "Hough", +"intl", "a=6378388.0", "rf=297.", "International 1909 (Hayford)", +"krass", "a=6378245.0", "rf=298.3", "Krassovsky, 1942", +"kaula", "a=6378163.", "rf=298.24", "Kaula 1961", +"lerch", "a=6378139.", "rf=298.257", "Lerch 1979", +"mprts", "a=6397300.", "rf=191.", "Maupertius 1738", +"new_intl", "a=6378157.5", "b=6356772.2", "New International 1967", +"plessis", "a=6376523.", "b=6355863.", "Plessis 1817 (France)", +"SEasia", "a=6378155.0", "b=6356773.3205", "Southeast Asia", +"walbeck", "a=6376896.0", "b=6355834.8467", "Walbeck", +"WGS60", "a=6378165.0", "rf=298.3", "WGS 60", +"WGS66", "a=6378145.0", "rf=298.25", "WGS 66", +"WGS72", "a=6378135.0", "rf=298.26", "WGS 72", +"WGS84", "a=6378137.0", "rf=298.257223563", "WGS 84", +0,0,0,0 +}; diff --git a/src/pj_errno.c b/src/pj_errno.c new file mode 100644 index 00000000..4156d7e5 --- /dev/null +++ b/src/pj_errno.c @@ -0,0 +1,8 @@ +/* For full ANSI compliance of global variable */ +#ifndef lint +static const char SCCSID[]="@(#)pj_errno.c 4.3 95/06/03 GIE REL"; +#endif + +int pj_errno = 0; + +/* end */ diff --git a/src/pj_factors.c b/src/pj_factors.c new file mode 100644 index 00000000..32021b89 --- /dev/null +++ b/src/pj_factors.c @@ -0,0 +1,86 @@ +/* projection scale factors */ +#ifndef lint +static const char SCCSID[]="@(#)pj_factors.c 4.9 94/03/17 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#include <errno.h> +#ifndef DEFAULT_H +#define DEFAULT_H 1e-5 /* radian default for numeric h */ +#endif +#define EPS 1.0e-12 + int +pj_factors(LP lp, PJ *P, double h, struct FACTORS *fac) { + struct DERIVS der; + double cosphi, t, n, r; + + /* check for forward and latitude or longitude overange */ + if ((t = fabs(lp.phi)-HALFPI) > EPS || fabs(lp.lam) > 10.) { + pj_errno = -14; + return 1; + } else { /* proceed */ + errno = pj_errno = 0; + if (fabs(t) <= EPS) /* adjust to pi/2 */ + lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + else if (P->geoc) + lp.phi = atan(P->rone_es * tan(lp.phi)); + lp.lam -= P->lam0; /* compute del lp.lam */ + if (!P->over) + lp.lam = adjlon(lp.lam); /* adjust del longitude */ + if (h <= 0.) + h = DEFAULT_H; + if (P->spc) /* get what projection analytic values */ + P->spc(lp, P, fac); + if (((fac->code & (IS_ANAL_XL_YL+IS_ANAL_XP_YP)) != + (IS_ANAL_XL_YL+IS_ANAL_XP_YP)) && + pj_deriv(lp, h, P, &der)) + return 1; + if (!(fac->code & IS_ANAL_XL_YL)) { + fac->der.x_l = der.x_l; + fac->der.y_l = der.y_l; + } + if (!(fac->code & IS_ANAL_XP_YP)) { + fac->der.x_p = der.x_p; + fac->der.y_p = der.y_p; + } + cosphi = cos(lp.phi); + if (!(fac->code & IS_ANAL_HK)) { + fac->h = hypot(fac->der.x_p, fac->der.y_p); + fac->k = hypot(fac->der.x_l, fac->der.y_l) / cosphi; + if (P->es) { + t = sin(lp.phi); + t = 1. - P->es * t * t; + n = sqrt(t); + fac->h *= t * n / P->one_es; + fac->k *= n; + r = t * t / P->one_es; + } else + r = 1.; + } else if (P->es) { + r = sin(lp.phi); + r = 1. - P->es * r * r; + r = r * r / P->one_es; + } else + r = 1.; + /* convergence */ + if (!(fac->code & IS_ANAL_CONV)) { + fac->conv = - atan2(fac->der.y_l, fac->der.x_l); + if (fac->code & IS_ANAL_XL_YL) + fac->code |= IS_ANAL_CONV; + } + /* areal scale factor */ + fac->s = (fac->der.y_p * fac->der.x_l - fac->der.x_p * fac->der.y_l) * + r / cosphi; + /* meridian-parallel angle theta prime */ + fac->thetap = aasin(fac->s / (fac->h * fac->k)); + /* Tissot ellips axis */ + t = fac->k * fac->k + fac->h * fac->h; + fac->a = sqrt(t + 2. * fac->s); + t = (t = t - 2. * fac->s) <= 0. ? 0. : sqrt(t); + fac->b = 0.5 * (fac->a - t); + fac->a = 0.5 * (fac->a + t); + /* omega */ + fac->omega = 2. * aasin((fac->a - fac->b)/(fac->a + fac->b)); + } + return 0; +} diff --git a/src/pj_fwd.c b/src/pj_fwd.c new file mode 100644 index 00000000..e88472af --- /dev/null +++ b/src/pj_fwd.c @@ -0,0 +1,37 @@ +/* general forward projection */ +#ifndef lint +static const char SCCSID[]="@(#)pj_fwd.c 4.4 93/06/12 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#include <errno.h> +# define EPS 1.0e-12 + XY /* forward projection entry */ +pj_fwd(LP lp, PJ *P) { + XY xy; + double t; + + /* check for forward and latitude or longitude overange */ + if ((t = fabs(lp.phi)-HALFPI) > EPS || fabs(lp.lam) > 10.) { + xy.x = xy.y = HUGE_VAL; + pj_errno = -14; + } else { /* proceed with projection */ + errno = pj_errno = 0; + if (fabs(t) <= EPS) + lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; + else if (P->geoc) + lp.phi = atan(P->rone_es * tan(lp.phi)); + lp.lam -= P->lam0; /* compute del lp.lam */ + if (!P->over) + lp.lam = adjlon(lp.lam); /* adjust del longitude */ + xy = (*P->fwd)(lp, P); /* project */ + if (pj_errno || (pj_errno = errno)) + xy.x = xy.y = HUGE_VAL; + /* adjust for major axis and easting/northings */ + else { + xy.x = P->fr_meter * (P->a * xy.x + P->x0); + xy.y = P->fr_meter * (P->a * xy.y + P->y0); + } + } + return xy; +} diff --git a/src/pj_init.c b/src/pj_init.c new file mode 100644 index 00000000..68b77c9c --- /dev/null +++ b/src/pj_init.c @@ -0,0 +1,176 @@ +/* projection initialization and closure */ +#ifndef lint +static const char SCCSID[]="@(#)pj_init.c 4.13 95/09/05 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + static paralist +*start; +extern FILE *pj_open_lib(char *, char *); + static paralist * +get_opt(FILE *fid, char *name, paralist *next) { + char sword[52], *word = sword+1; + int first = 1, len, c; + + len = strlen(name); + *sword = 't'; + while (fscanf(fid, "%50s", word) == 1) + if (*word == '#') /* skip comments */ + while((c = fgetc(fid)) != EOF && c != '\n') ; + else if (*word == '<') { /* control name */ + if (first && !strncmp(name, word + 1, len) + && word[len + 1] == '>') + first = 0; + else if (!first && word[1] == '>') + break; + } else if (!first && !pj_param(start, sword).i) + next = next->next = pj_mkparam(word); + if (errno == 25) + errno = 0; + return next; +} + static paralist * +get_defaults(paralist *next, char *name) { + FILE *fid; + + if (fid = pj_open_lib("proj_def.dat", "r")) { + next = get_opt(fid, "general", next); + rewind(fid); + next = get_opt(fid, name, next); + (void)fclose(fid); + } + if (errno) + errno = 0; /* don't care if can't open file */ + return next; +} + static paralist * +get_init(paralist *next, char *name) { + char fname[MAX_PATH_FILENAME+ID_TAG_MAX+3], *opt; + FILE *fid; + + (void)strncpy(fname, name, MAX_PATH_FILENAME + ID_TAG_MAX + 1); + if (opt = strrchr(fname, ':')) + *opt++ = '\0'; + else { pj_errno = -3; return(0); } + if (fid = pj_open_lib(fname, "r")) + next = get_opt(fid, opt, next); + else + return(0); + (void)fclose(fid); + if (errno == 25) + errno = 0; /* unknown problem with some sys errno<-25 */ + return next; +} + PJ * +pj_init(int argc, char **argv) { + char *s, *name; + void *(*proj)(PJ *); + paralist *curr; + int i; + PJ *PIN = 0; + + errno = pj_errno = 0; + /* put arguments into internal linked list */ + if (argc <= 0) { pj_errno = -1; goto bum_call; } + for (i = 0; i < argc; ++i) + if (i) + curr = curr->next = pj_mkparam(argv[i]); + else + start = curr = pj_mkparam(argv[i]); + if (pj_errno) goto bum_call; + /* check if +init present */ + if (pj_param(start, "tinit").i) { + paralist *last = curr; + + if (!(curr = get_init(curr, pj_param(start, "sinit").s))) + goto bum_call; + if (curr == last) { pj_errno = -2; goto bum_call; } + } + /* find projection selection */ + if (!(name = pj_param(start, "sproj").s)) + { pj_errno = -4; goto bum_call; } + for (i = 0; (s = pj_list[i].id) && strcmp(name, s) ; ++i) ; + if (!s) { pj_errno = -5; goto bum_call; } + /* set defaults, unless inhibited */ + if (!pj_param(start, "bno_defs").i) + curr = get_defaults(curr, name); + proj = pj_list[i].proj; + /* allocate projection structure */ + if (!(PIN = (*proj)(0))) goto bum_call; + PIN->params = start; + /* set ellipsoid/sphere parameters */ + if (pj_ell_set(start, &PIN->a, &PIN->es)) goto bum_call; + PIN->e = sqrt(PIN->es); + PIN->ra = 1. / PIN->a; + PIN->one_es = 1. - PIN->es; + if (PIN->one_es == 0.) { pj_errno = -6; goto bum_call; } + PIN->rone_es = 1./PIN->one_es; + /* set PIN->geoc coordinate system */ + PIN->geoc = (PIN->es && pj_param(start, "bgeoc").i); + /* over-ranging flag */ + PIN->over = pj_param(start, "bover").i; + /* central meridian */ + PIN->lam0=pj_param(start, "rlon_0").f; + /* central latitude */ + PIN->phi0 = pj_param(start, "rlat_0").f; + /* false easting and northing */ + PIN->x0 = pj_param(start, "dx_0").f; + PIN->y0 = pj_param(start, "dy_0").f; + /* general scaling factor */ + if (pj_param(start, "tk_0").i) + PIN->k0 = pj_param(start, "dk_0").f; + else if (pj_param(start, "tk").i) + PIN->k0 = pj_param(start, "dk").f; + else + PIN->k0 = 1.; + if (PIN->k0 <= 0.) { + pj_errno = -31; + goto bum_call; + } + /* set units */ + s = 0; + if (name = pj_param(start, "sunits").s) { + for (i = 0; (s = pj_units[i].id) && strcmp(name, s) ; ++i) ; + if (!s) { pj_errno = -7; goto bum_call; } + s = pj_units[i].to_meter; + } + if (s || (s = pj_param(start, "sto_meter").s)) { + PIN->to_meter = strtod(s, &s); + if (*s == '/') /* ratio number */ + PIN->to_meter /= strtod(++s, 0); + PIN->fr_meter = 1. / PIN->to_meter; + } else + PIN->to_meter = PIN->fr_meter = 1.; + /* projection specific initialization */ + if (!(PIN = (*proj)(PIN)) || errno || pj_errno) { +bum_call: /* cleanup error return */ + if (!pj_errno) + pj_errno = errno; + if (PIN) + pj_free(PIN); + else + for ( ; start; start = curr) { + curr = start->next; + pj_dalloc(start); + } + PIN = 0; + } + return PIN; +} + void +pj_free(PJ *P) { + if (P) { + paralist *t = P->params, *n; + + /* free parameter list elements */ + for (t = P->params; t; t = n) { + n = t->next; + pj_dalloc(t); + } + /* free projection parameters */ + P->pfree(P); + } +} diff --git a/src/pj_inv.c b/src/pj_inv.c new file mode 100644 index 00000000..16dd90dd --- /dev/null +++ b/src/pj_inv.c @@ -0,0 +1,32 @@ +/* general inverse projection */ +#ifndef lint +static const char SCCSID[]="@(#)pj_inv.c 4.5 93/06/12 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#include <errno.h> +# define EPS 1.0e-12 + LP /* inverse projection entry */ +pj_inv(XY xy, PJ *P) { + LP lp; + + /* can't do as much preliminary checking as with forward */ + if (xy.x == HUGE_VAL || xy.y == HUGE_VAL) { + lp.lam = lp.phi = HUGE_VAL; + pj_errno = -15; + } + errno = pj_errno = 0; + xy.x = (xy.x * P->to_meter - P->x0) * P->ra; /* descale and de-offset */ + xy.y = (xy.y * P->to_meter - P->y0) * P->ra; + lp = (*P->inv)(xy, P); /* inverse project */ + if (pj_errno || (pj_errno = errno)) + lp.lam = lp.phi = HUGE_VAL; + else { + lp.lam += P->lam0; /* reduce from del lp.lam */ + if (!P->over) + lp.lam = adjlon(lp.lam); /* adjust longitude to CM */ + if (P->geoc && fabs(fabs(lp.phi)-HALFPI) > EPS) + lp.phi = atan(P->one_es * tan(lp.phi)); + } + return lp; +} diff --git a/src/pj_list.c b/src/pj_list.c new file mode 100644 index 00000000..79a6ca02 --- /dev/null +++ b/src/pj_list.c @@ -0,0 +1,8 @@ +#ifndef lint +static const char SCCSID[]="@(#)pj_list.c 4.6 94/02/15 GIE REL"; +#endif +/* Projection System: default list of projections +** Use local definition of PJ_LIST_H for subset. +*/ +#define PJ_LIST_H "pj_list.h" +#include "projects.h" diff --git a/src/pj_list.h b/src/pj_list.h new file mode 100644 index 00000000..3a1c300d --- /dev/null +++ b/src/pj_list.h @@ -0,0 +1,126 @@ +#ifdef DO_PJ_LIST_ID +static const char PJ_LIST_H_ID[] = "@(#)pj_list.h 4.5 95/08/09 GIE REL"; +#endif +/* Full list of current projections for Tue Jan 11 12:27:04 EST 1994 +** +** Copy this file and retain only appropriate lines for subset list +*/ +PROJ_HEAD(aea, "Albers Equal Area") +PROJ_HEAD(aeqd, "Azimuthal Equidistant") +PROJ_HEAD(airy, "Airy") +PROJ_HEAD(aitoff, "Aitoff") +PROJ_HEAD(alsk, "Mod. Stererographics of Alaska") +PROJ_HEAD(apian, "Apian Globular I") +PROJ_HEAD(august, "August Epicycloidal") +PROJ_HEAD(bacon, "Bacon Globular") +PROJ_HEAD(bipc, "Bipolar conic of western hemisphere") +PROJ_HEAD(boggs, "Boggs Eumorphic") +PROJ_HEAD(bonne, "Bonne (Werner lat_1=90)") +PROJ_HEAD(cass, "Cassini") +PROJ_HEAD(cc, "Central Cylindrical") +PROJ_HEAD(cea, "Equal Area Cylindrical") +PROJ_HEAD(chamb, "Chamberlin Trimetric") +PROJ_HEAD(collg, "Collignon") +PROJ_HEAD(crast, "Craster Parabolic (Putnins P4)") +PROJ_HEAD(denoy, "Denoyer Semi-Elliptical") +PROJ_HEAD(eck1, "Eckert I") +PROJ_HEAD(eck2, "Eckert II") +PROJ_HEAD(eck3, "Eckert III") +PROJ_HEAD(eck4, "Eckert IV") +PROJ_HEAD(eck5, "Eckert V") +PROJ_HEAD(eck6, "Eckert VI") +PROJ_HEAD(eqc, "Equidistant Cylindrical (Plate Caree)") +PROJ_HEAD(eqdc, "Equidistant Conic") +PROJ_HEAD(euler, "Euler") +PROJ_HEAD(fahey, "Fahey") +PROJ_HEAD(fouc, "Foucaut") +PROJ_HEAD(fouc_s, "Foucaut Sinusoidal") +PROJ_HEAD(gall, "Gall (Gall Stereographic)") +PROJ_HEAD(gins8, "Ginsburg VIII (TsNIIGAiK)") +PROJ_HEAD(gn_sinu, "General Sinusoidal Series") +PROJ_HEAD(gnom, "Gnomonic") +PROJ_HEAD(goode, "Goode Homolosine") +PROJ_HEAD(gs48, "Mod. Stererographics of 48 U.S.") +PROJ_HEAD(gs50, "Mod. Stererographics of 50 U.S.") +PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff") +PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") +PROJ_HEAD(imw_p, "Internation Map of the World Polyconic") +PROJ_HEAD(kav5, "Kavraisky V") +PROJ_HEAD(kav7, "Kavraisky VII") +PROJ_HEAD(labrd, "Laborde") +PROJ_HEAD(laea, "Lambert Azimuthal Equal Area") +PROJ_HEAD(lagrng, "Lagrange") +PROJ_HEAD(larr, "Larrivee") +PROJ_HEAD(lask, "Laskowski") +PROJ_HEAD(lcc, "Lambert Conformal Conic") +PROJ_HEAD(leac, "Lambert Equal Area Conic") +PROJ_HEAD(lee_os, "Lee Oblated Stereographic") +PROJ_HEAD(loxim, "Loximuthal") +PROJ_HEAD(lsat, "Space oblique for LANDSAT") +PROJ_HEAD(mbt_s, "McBryde-Thomas Flat-Polar Sine") +PROJ_HEAD(mbt_fps, "McBryde-Thomas Flat-Pole Sine (No. 2)") +PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") +PROJ_HEAD(mbtfpq, "McBryde-Thomas Flat-Polar Quartic") +PROJ_HEAD(mbtfps, "McBryde-Thomas Flat-Polar Sinusoidal") +PROJ_HEAD(merc, "Mercator") +PROJ_HEAD(mil_os, "Miller Oblated Stereographic") +PROJ_HEAD(mill, "Miller Cylindrical") +PROJ_HEAD(mpoly, "Modified Polyconic") +PROJ_HEAD(moll, "Mollweide") +PROJ_HEAD(murd1, "Murdoch I") +PROJ_HEAD(murd2, "Murdoch II") +PROJ_HEAD(murd3, "Murdoch III") +PROJ_HEAD(nell, "Nell") +PROJ_HEAD(nell_h, "Nell-Hammer") +PROJ_HEAD(nicol, "Nicolosi Globular") +PROJ_HEAD(nsper, "Near-sided perspective") +PROJ_HEAD(nzmg, "New Zealand Map Grid") +PROJ_HEAD(ob_tran, "General Oblique Transformation") +PROJ_HEAD(ocea, "Oblique Cylindrical Equal Area") +PROJ_HEAD(oea, "Oblated Equal Area") +PROJ_HEAD(omerc, "Oblique Mercator") +PROJ_HEAD(ortel, "Ortelius Oval") +PROJ_HEAD(ortho, "Orthographic") +PROJ_HEAD(pconic, "Perspective Conic") +PROJ_HEAD(poly, "Polyconic (American)") +PROJ_HEAD(putp1, "Putnins P1") +PROJ_HEAD(putp2, "Putnins P2") +PROJ_HEAD(putp3, "Putnins P3") +PROJ_HEAD(putp3p, "Putnins P3'") +PROJ_HEAD(putp4p, "Putnins P4'") +PROJ_HEAD(putp5, "Putnins P5") +PROJ_HEAD(putp5p, "Putnins P5'") +PROJ_HEAD(putp6, "Putnins P6") +PROJ_HEAD(putp6p, "Putnins P6'") +PROJ_HEAD(qua_aut, "Quartic Authalic") +PROJ_HEAD(robin, "Robinson") +PROJ_HEAD(rpoly, "Rectangular Polyconic") +PROJ_HEAD(sinu, "Sinusoidal (Sanson-Flamsteed)") +PROJ_HEAD(somerc, "Swiss. Obl. Mercator") +PROJ_HEAD(stere, "Stereographic") +PROJ_HEAD(tcc, "Transverse Central Cylindrical") +PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") +PROJ_HEAD(tissot, "Tissot Conic") +PROJ_HEAD(tmerc, "Transverse Mercator") +PROJ_HEAD(tpeqd, "Two Point Equidistant") +PROJ_HEAD(tpers, "Tilted perspective") +PROJ_HEAD(ups, "Universal Polar Stereographic") +PROJ_HEAD(urm5, "Urmaev V") +PROJ_HEAD(urmfps, "Urmaev Flat-Polar Sinusoidal") +PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") +PROJ_HEAD(vandg, "van der Grinten (I)") +PROJ_HEAD(vandg2, "van der Grinten II") +PROJ_HEAD(vandg3, "van der Grinten III") +PROJ_HEAD(vandg4, "van der Grinten IV") +PROJ_HEAD(vitk1, "Vitkovsky I") +PROJ_HEAD(wag1, "Wagner I (Kavraisky VI)") +PROJ_HEAD(wag2, "Wagner II") +PROJ_HEAD(wag3, "Wagner III") +PROJ_HEAD(wag4, "Wagner IV") +PROJ_HEAD(wag5, "Wagner V") +PROJ_HEAD(wag6, "Wagner VI") +PROJ_HEAD(wag7, "Wagner VII") +PROJ_HEAD(weren, "Werenskiold I") +PROJ_HEAD(wink1, "Winkel I") +PROJ_HEAD(wink2, "Winkel II") +PROJ_HEAD(wintri, "Winkel Tripel") diff --git a/src/pj_malloc.c b/src/pj_malloc.c new file mode 100644 index 00000000..6beb502a --- /dev/null +++ b/src/pj_malloc.c @@ -0,0 +1,16 @@ +/* allocate and deallocate memory */ +#ifndef lint +static const char SCCSID[]="@(#)pj_malloc.c 4.3 93/06/12 GIE REL"; +#endif +/* These routines are used so that applications can readily replace +** projection system memory allocation/deallocation call with custom +** application procedures. */ +#include <projects.h> + void * +pj_malloc(size_t size) { + return(malloc(size)); +} + void +pj_dalloc(void *ptr) { + free(ptr); +} diff --git a/src/pj_mlfn.c b/src/pj_mlfn.c new file mode 100644 index 00000000..0b980c06 --- /dev/null +++ b/src/pj_mlfn.c @@ -0,0 +1,60 @@ +#ifndef lint +static const char SCCSID[]="@(#)pj_mlfn.c 4.5 95/07/06 GIE REL"; +#endif +#include <projects.h> +/* meridinal distance for ellipsoid and inverse +** 8th degree - accurate to < 1e-5 meters when used in conjuction +** with typical major axis values. +** Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds. +*/ +#define C00 1. +#define C02 .25 +#define C04 .046875 +#define C06 .01953125 +#define C08 .01068115234375 +#define C22 .75 +#define C44 .46875 +#define C46 .01302083333333333333 +#define C48 .00712076822916666666 +#define C66 .36458333333333333333 +#define C68 .00569661458333333333 +#define C88 .3076171875 +#define EPS 1e-11 +#define MAX_ITER 10 +#define EN_SIZE 5 + double * +pj_enfn(double es) { + double t, *en; + + if (en = (double *)pj_malloc(EN_SIZE * sizeof(double))) { + en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08))); + en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08))); + en[2] = (t = es * es) * (C44 - es * (C46 + es * C48)); + en[3] = (t *= es) * (C66 - es * C68); + en[4] = t * es * C88; + } /* else return NULL if unable to allocate memory */ + return en; +} + double +pj_mlfn(double phi, double sphi, double cphi, double *en) { + cphi *= sphi; + sphi *= sphi; + return(en[0] * phi - cphi * (en[1] + sphi*(en[2] + + sphi*(en[3] + sphi*en[4])))); +} + double +pj_inv_mlfn(double arg, double es, double *en) { + double s, t, phi, k = 1./(1.-es); + int i; + + phi = arg; + for (i = MAX_ITER; i ; --i) { /* rarely goes over 2 iterations */ + s = sin(phi); + t = 1. - es * s * s; + phi -= t = (pj_mlfn(phi, s, cos(phi), en) - arg) * (t * sqrt(t)) * k; + if (fabs(t) < EPS) + return phi; + } + pj_errno = -17; + return phi; +} diff --git a/src/pj_msfn.c b/src/pj_msfn.c new file mode 100644 index 00000000..55e3983c --- /dev/null +++ b/src/pj_msfn.c @@ -0,0 +1,9 @@ +/* determine constant small m */ +#ifndef lint +static const char SCCSID[]="@(#)pj_msfn.c 4.3 93/06/12 GIE REL"; +#endif +#include <math.h> + double +pj_msfn(double sinphi, double cosphi, double es) { + return (cosphi / sqrt (1. - es * sinphi * sinphi)); +} diff --git a/src/pj_open_lib.c b/src/pj_open_lib.c new file mode 100644 index 00000000..3de0ad3e --- /dev/null +++ b/src/pj_open_lib.c @@ -0,0 +1,49 @@ +/* standard location file open procedure */ +#ifndef lint +static const char SCCSID[]="@(#)pj_open_lib.c 4.5 94/10/30 GIE REL"; +#endif +#define PJ_LIB__ +#include <projects.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + static char * +proj_lib_name = +#ifdef PROJ_LIB +PROJ_LIB; +#else +0; +#endif + FILE * +pj_open_lib(char *name, char *mode) { + char fname[MAX_PATH_FILENAME+1], *sysname; + FILE *fid; + int n = 0; + + /* check if ~/name */ + if (*name == '~' && name[1] == DIR_CHAR) + if (sysname = getenv("HOME")) { + (void)strcpy(fname, sysname); + fname[n = strlen(fname)] = DIR_CHAR; + fname[++n] = '\0'; + (void)strcpy(fname+n, name + 1); + sysname = fname; + } else + return NULL; + /* or fixed path: /name, ./name or ../name */ + else if (*name == DIR_CHAR || (*name == '.' && name[1] == DIR_CHAR) || + (!strncmp(name, "..", 2) && name[2] == DIR_CHAR) ) + sysname = name; + /* or is environment PROJ_LIB defined */ + else if ((sysname = getenv("PROJ_LIB")) || (sysname = proj_lib_name)) { + (void)strcpy(fname, sysname); + fname[n = strlen(fname)] = DIR_CHAR; + fname[++n] = '\0'; + (void)strcpy(fname+n, name); + sysname = fname; + } else /* just try it bare bones */ + sysname = name; + if (fid = fopen(sysname, mode)) + errno = 0; + return(fid); +} diff --git a/src/pj_param.c b/src/pj_param.c new file mode 100644 index 00000000..25b104d4 --- /dev/null +++ b/src/pj_param.c @@ -0,0 +1,89 @@ +/* put parameters in linked list and retrieve */ +#ifndef lint +static const char SCCSID[]="@(#)pj_param.c 4.4 93/06/12 GIE REL"; +#endif +#include <projects.h> +#include <stdio.h> +#include <string.h> + paralist * /* create parameter list entry */ +pj_mkparam(char *str) { + paralist *new; + + if (new = (paralist *)pj_malloc(sizeof(paralist) + strlen(str))) { + new->used = 0; + new->next = 0; + if (*str == '+') + ++str; + (void)strcpy(new->param, str); + } + return new; +} + PVALUE /* test for presence or get parameter value */ +pj_param(paralist *pl, char *opt) { + int type; + unsigned l; + PVALUE value; + + type = *opt++; + /* simple linear lookup */ + l = strlen(opt); + while (pl && !(!strncmp(pl->param, opt, l) && + (!pl->param[l] || pl->param[l] == '='))) + pl = pl->next; + if (type == 't') + value.i = pl != 0; + else if (pl) { + pl->used |= 1; + opt = pl->param + l; + if (*opt == '=') + ++opt; + switch (type) { + case 'i': /* integer input */ + value.i = atoi(opt); + break; + case 'd': /* simple real input */ + value.f = atof(opt); + break; + case 'r': /* degrees input */ + value.f = dmstor(opt, 0); + break; + case 's': /* char string */ + value.s = opt; + break; + case 'b': /* boolean */ + switch (*opt) { + case 'F': case 'f': + value.i = 0; + break; + case '\0': case 'T': case 't': + value.i = 1; + break; + default: + pj_errno = -8; + value.i = 0; + break; + } + break; + default: +bum_type: /* note: this is an error in parameter, not a user error */ + fprintf(stderr, "invalid request to pj_param, fatal\n"); + exit(1); + } + } else /* not given */ + switch (type) { + case 'b': + case 'i': + value.i = 0; + break; + case 'd': + case 'r': + value.f = 0.; + break; + case 's': + value.s = 0; + break; + default: + goto bum_type; + } + return value; +} diff --git a/src/pj_phi2.c b/src/pj_phi2.c new file mode 100644 index 00000000..dbb79d4d --- /dev/null +++ b/src/pj_phi2.c @@ -0,0 +1,28 @@ +/* determine latitude angle phi-2 */ +#ifndef lint +static const char SCCSID[]="@(#)pj_phi2.c 4.3 93/06/12 GIE REL"; +#endif +#include <projects.h> + +#define HALFPI 1.5707963267948966 +#define TOL 1.0e-10 +#define N_ITER 15 + + double +pj_phi2(double ts, double e) { + double eccnth, Phi, con, dphi; + int i; + + eccnth = .5 * e; + Phi = HALFPI - 2. * atan (ts); + i = N_ITER; + do { + con = e * sin (Phi); + dphi = HALFPI - 2. * atan (ts * pow((1. - con) / + (1. + con), eccnth)) - Phi; + Phi += dphi; + } while ( fabs(dphi) > TOL && --i); + if (i <= 0) + pj_errno = -18; + return Phi; +} diff --git a/src/pj_pr_list.c b/src/pj_pr_list.c new file mode 100644 index 00000000..e4feeda6 --- /dev/null +++ b/src/pj_pr_list.c @@ -0,0 +1,48 @@ +/* print projection's list of parameters */ +#ifndef lint +static const char SCCSID[]="@(#)pj_pr_list.c 4.6 94/03/19 GIE REL"; +#endif +#include <projects.h> +#include <stdio.h> +#include <string.h> +#define LINE_LEN 72 + static int +pr_list(PJ *P, int not_used) { + paralist *t; + int l, n = 1, flag = 0; + + (void)putchar('#'); + for (t = P->params; t; t = t->next) + if ((!not_used && t->used) || (not_used && !t->used)) { + l = strlen(t->param) + 1; + if (n + l > LINE_LEN) { + (void)fputs("\n#", stdout); + n = 2; + } + (void)putchar(' '); + if (*(t->param) != '+') + (void)putchar('+'); + (void)fputs(t->param, stdout); + n += l; + } else + flag = 1; + if (n > 1) + (void)putchar('\n'); + return flag; +} + void /* print link list of projection parameters */ +pj_pr_list(PJ *P) { + char const *s; + + (void)putchar('#'); + for (s = P->descr; *s ; ++s) { + (void)putchar(*s); + if (*s == '\n') + (void)putchar('#'); + } + (void)putchar('\n'); + if (pr_list(P, 0)) { + (void)fputs("#--- following specified but NOT used\n", stdout); + (void)pr_list(P, 1); + } +} diff --git a/src/pj_qsfn.c b/src/pj_qsfn.c new file mode 100644 index 00000000..c0610be3 --- /dev/null +++ b/src/pj_qsfn.c @@ -0,0 +1,17 @@ +/* determine small q */ +#ifndef lint +static const char SCCSID[]="@(#)pj_qsfn.c 4.3 93/06/12 GIE REL"; +#endif +#include <math.h> +# define EPSILON 1.0e-7 + double +pj_qsfn(double sinphi, double e, double one_es) { + double con; + + if (e >= EPSILON) { + con = e * sinphi; + return (one_es * (sinphi / (1. - con * con) - + (.5 / e) * log ((1. - con) / (1. + con)))); + } else + return (sinphi + sinphi); +} diff --git a/src/pj_release.c b/src/pj_release.c new file mode 100644 index 00000000..a01d3b2e --- /dev/null +++ b/src/pj_release.c @@ -0,0 +1,6 @@ +/* <<< Release Notice for library >>> */ +#ifndef lint +static const char SCCSID[]="@(#)pj_release.c 4.5 95/09/23 GIE REL"; +#endif + +char const pj_release[]="Rel. 4.3.3, 23 Sept. 1995"; diff --git a/src/pj_strerrno.c b/src/pj_strerrno.c new file mode 100644 index 00000000..4e5192fc --- /dev/null +++ b/src/pj_strerrno.c @@ -0,0 +1,72 @@ +/* list of projection system pj_errno values */ +#ifndef lint +static const char SCCSID[]="@(#)pj_strerrno.c 4.12 94/05/25 GIE REL"; +#endif +#include <errno.h> +#include <string.h> + static char * +pj_err_list[] = { + "no arguments in initialization list", /* -1 */ + "no options found in 'init' file", /* -2 */ + "no colon in init= string", /* -3 */ + "projection not named", /* -4 */ + "unknown projection id", /* -5 */ + "effective eccentricity = 1.", /* -6 */ + "unknown unit conversion id", /* -7 */ + "invalid boolean param argument", /* -8 */ + "unknown elliptical parameter name", /* -9 */ + "reciprocal flattening (1/f) = 0", /* -10 */ + "|radius reference latitude| > 90", /* -11 */ + "squared eccentricity < 0", /* -12 */ + "major axis or radius = 0 or not given", /* -13 */ + "latitude or longitude exceeded limits", /* -14 */ + "invalid x or y", /* -15 */ + "improperly formed DMS value", /* -16 */ + "non-convergent inverse meridinal dist", /* -17 */ + "non-convergent inverse phi2", /* -18 */ + "acos/asin: |arg| >1.+1e-14", /* -19 */ + "tolerance condition error", /* -20 */ + "conic lat_1 = -lat_2", /* -21 */ + "lat_1 >= 90", /* -22 */ + "lat_1 = 0", /* -23 */ + "lat_ts >= 90", /* -24 */ + "no distance between control points", /* -25 */ + "projection not selected to be rotated", /* -26 */ + "W <= 0 or M <= 0", /* -27 */ + "lsat not in 1-5 range", /* -28 */ + "path not in range", /* -29 */ + "h <= 0", /* -30 */ + "k <= 0", /* -31 */ + "lat_0 = 0 or 90 or alpha = 90", /* -32 */ + "lat_1=lat_2 or lat_1=0 or lat_2=90", /* -33 */ + "elliptical usage required", /* -34 */ + "invalid UTM zone number", /* -35 */ + "arg(s) out of range for Tcheby eval", /* -36 */ + "failed to find projection to be rotated", /* -37 */ + "failed to load NAD27-83 correction file", /* -38 */ + "both n & m must be spec'd and > 0", /* -39 */ + "n <= 0, n > 1 or not specified", /* -40 */ + "lat_1 or lat_2 not specified", /* -41 */ + "|lat_1| == |lat_2|", /* -42 */ + "lat_0 is pi/2 from mean lat", /* -43 */ +}; + char * +pj_strerrno(int err) { + if (err > 0) +#ifdef HAVE_STRERROR + return strerror(err); +#else + { static char note[50]; + sprintf(note,"no system list, errno: %d\n", err); + return note; + } +#endif + else if (err < 0) { + err = - err - 1; + if (err < (sizeof(pj_err_list) / sizeof(char *))) + return(pj_err_list[err]); + else + return("invalid projection system error number"); + } else + return 0; +} diff --git a/src/pj_tsfn.c b/src/pj_tsfn.c new file mode 100644 index 00000000..3c223e05 --- /dev/null +++ b/src/pj_tsfn.c @@ -0,0 +1,12 @@ +/* determine small t */ +#ifndef lint +static const char SCCSID[]="@(#)pj_tsfn.c 4.3 93/06/12 GIE REL"; +#endif +#include <math.h> +#define HALFPI 1.5707963267948966 + double +pj_tsfn(double phi, double sinphi, double e) { + sinphi *= e; + return (tan (.5 * (HALFPI - phi)) / + pow((1. - sinphi) / (1. + sinphi), .5 * e)); +} diff --git a/src/pj_units.c b/src/pj_units.c new file mode 100644 index 00000000..a29b3a18 --- /dev/null +++ b/src/pj_units.c @@ -0,0 +1,34 @@ +/* definition of standard cartesian units */ +#ifndef lint +static const char SCCSID[]="@(#)pj_units.c 4.6 93/06/12 GIE REL"; +#endif +#define PJ_UNITS__ +#include <projects.h> +/* Field 2 that contains the multiplier to convert named units to meters +** may be expressed by either a simple floating point constant or a +** numerator/denomenator values (e.g. 1/1000) */ + struct PJ_UNITS +pj_units[] = { + "km", "1000.", "Kilometer", + "m", "1.", "Meter", + "dm", "1/10", "Decimeter", + "cm", "1/100", "Centimeter", + "mm", "1/1000", "Millimeter", + "kmi", "1852.0", "International Nautical Mile", + "in", "0.0254", "International Inch", + "ft", "0.3048", "International Foot", + "yd", "0.9144", "International Yard", + "mi", "1609.344", "International Statute Mile", + "fath", "1.8288", "International Fathom", + "ch", "20.1168", "International Chain", + "link", "0.201168", "International Link", + "us-in", "1./39.37", "U.S. Surveyor's Inch", + "us-ft", "0.304800609601219", "U.S. Surveyor's Foot", + "us-yd", "0.914401828803658", "U.S. Surveyor's Yard", + "us-ch", "20.11684023368047", "U.S. Surveyor's Chain", + "us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile", + "ind-yd", "0.91439523", "Indian Yard", + "ind-ft", "0.30479841", "Indian Foot", + "ind-ch", "20.11669506", "Indian Chain", +(char *)0, (char *)0, (char *)0 +}; diff --git a/src/pj_zpoly1.c b/src/pj_zpoly1.c new file mode 100644 index 00000000..80d85469 --- /dev/null +++ b/src/pj_zpoly1.c @@ -0,0 +1,49 @@ +/* evaluate complex polynomial */ +#ifndef lint +static const char SCCSID[]="@(#)pj_zpoly1.c 4.3 93/06/12 GIE REL"; +#endif +#include <projects.h> +/* note: coefficients are always from C_1 to C_n +** i.e. C_0 == (0., 0) +** n should always be >= 1 though no checks are made +*/ + COMPLEX +pj_zpoly1(COMPLEX z, COMPLEX *C, int n) { + COMPLEX a; + double t; + + a = *(C += n); + while (n-- > 0) { + a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; + a.i = C->i + z.r * a.i + z.i * t; + } + a.r = z.r * (t = a.r) - z.i * a.i; + a.i = z.r * a.i + z.i * t; + return a; +} +/* evaluate complex polynomial and derivative */ + COMPLEX +pj_zpolyd1(COMPLEX z, COMPLEX *C, int n, COMPLEX *der) { + COMPLEX a, b; + double t; + int first = 1; + + a = *(C += n); + while (n-- > 0) { + if (first) { + first = 0; + b = a; + } else { + b.r = a.r + z.r * (t = b.r) - z.i * b.i; + b.i = a.i + z.r * b.i + z.i * t; + } + a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; + a.i = C->i + z.r * a.i + z.i * t; + } + b.r = a.r + z.r * (t = b.r) - z.i * b.i; + b.i = a.i + z.r * b.i + z.i * t; + a.r = z.r * (t = a.r) - z.i * a.i; + a.i = z.r * a.i + z.i * t; + *der = b; + return a; +} diff --git a/src/proj.c b/src/proj.c new file mode 100644 index 00000000..e14b5b26 --- /dev/null +++ b/src/proj.c @@ -0,0 +1,454 @@ +/* <<<< Cartographic projection filter program >>>> */ +#ifndef lint +static const char SCCSID[]="@(#)proj.c 4.12 95/09/23 GIE REL"; +#endif +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include <math.h> +#include "projects.h" +#include "emess.h" + +#define MAX_LINE 200 +#define MAX_PARGS 100 +#define PJ_INVERS(P) (P->inv ? 1 : 0) + static PJ +*Proj; + static UV +(*proj)(UV, PJ *); + static int +reversein = 0, /* != 0 reverse input arguments */ +reverseout = 0, /* != 0 reverse output arguments */ +bin_in = 0, /* != 0 then binary input */ +bin_out = 0, /* != 0 then binary output */ +echoin = 0, /* echo input data to output line */ +tag = '#', /* beginning of line tag character */ +inverse = 0, /* != 0 then inverse projection */ +prescale = 0, /* != 0 apply cartesian scale factor */ +dofactors = 0, /* determine scale factors */ +facs_bad = 0, /* return condition from pj_factors */ +very_verby = 0, /* very verbose mode */ +postscale = 0; + static char +*cheby_str, /* string controlling Chebychev evaluation */ +*oform = (char *)0, /* output format for x-y or decimal degrees */ +*oterr = "*\t*", /* output line for unprojectable input */ +*usage = +"%s\nusage: %s [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n"; + static struct FACTORS +facs; + static double +(*informat)(const char *, char **), /* input data deformatter function */ +fscale = 0.; /* cartesian scale factor */ + static UV +int_proj(data) UV data; { + if (prescale) { data.u *= fscale; data.v *= fscale; } + data = (*proj)(data, Proj); + if (postscale && data.u != HUGE_VAL) + { data.u *= fscale; data.v *= fscale; } + return(data); +} + static void /* file processing function */ +process(FILE *fid) { + char line[MAX_LINE+3], *s, pline[40]; + UV data; + + for (;;) { + ++emess_dat.File_line; + if (bin_in) { /* binary input */ + if (fread(&data, sizeof(UV), 1, fid) != 1) + break; + } else { /* ascii input */ + if (!(s = fgets(line, MAX_LINE, fid))) + break; + if (!strchr(s, '\n')) { /* overlong line */ + int c; + (void)strcat(s, "\n"); + /* gobble up to newline */ + while ((c = fgetc(fid)) != EOF && c != '\n') ; + } + if (*s == tag) { + if (!bin_out) + (void)fputs(line, stdout); + continue; + } + if (reversein) { + data.v = (*informat)(s, &s); + data.u = (*informat)(s, &s); + } else { + data.u = (*informat)(s, &s); + data.v = (*informat)(s, &s); + } + if (data.v == HUGE_VAL) + data.u = HUGE_VAL; + if (!*s && (s > line)) --s; /* assumed we gobbled \n */ + if (!bin_out && echoin) { + int t; + t = *s; + *s = '\0'; + (void)fputs(line, stdout); + *s = t; + putchar('\t'); + } + } + if (data.u != HUGE_VAL) { + if (prescale) { data.u *= fscale; data.v *= fscale; } + if (dofactors && !inverse) + facs_bad = pj_factors(data, Proj, 0., &facs); + data = (*proj)(data, Proj); + if (dofactors && inverse) + facs_bad = pj_factors(data, Proj, 0., &facs); + if (postscale && data.u != HUGE_VAL) + { data.u *= fscale; data.v *= fscale; } + } + if (bin_out) { /* binary output */ + (void)fwrite(&data, sizeof(UV), 1, stdout); + continue; + } else if (data.u == HUGE_VAL) /* error output */ + (void)fputs(oterr, stdout); + else if (inverse && !oform) { /*ascii DMS output */ + if (reverseout) { + (void)fputs(rtodms(pline, data.v, 'N', 'S'), stdout); + putchar('\t'); + (void)fputs(rtodms(pline, data.u, 'E', 'W'), stdout); + } else { + (void)fputs(rtodms(pline, data.u, 'E', 'W'), stdout); + putchar('\t'); + (void)fputs(rtodms(pline, data.v, 'N', 'S'), stdout); + } + } else { /* x-y or decimal degree ascii output */ + if (inverse) { + data.v *= RAD_TO_DEG; + data.u *= RAD_TO_DEG; + } + if (reverseout) { + (void)printf(oform,data.v); putchar('\t'); + (void)printf(oform,data.u); + } else { + (void)printf(oform,data.u); putchar('\t'); + (void)printf(oform,data.v); + } + } + if (dofactors) /* print scale factor data */ + if (!facs_bad) + (void)printf("\t<%g %g %g %g %g %g>", + facs.h, facs.k, facs.s, + facs.omega * RAD_TO_DEG, facs.a, facs.b); + else + (void)fputs("\t<* * * * * *>", stdout); + (void)fputs(bin_in ? "\n" : s, stdout); + } +} + static void /* file processing function --- verbosely */ +vprocess(FILE *fid) { + char line[MAX_LINE+3], *s, pline[40]; + UV dat_ll, dat_xy; + int linvers; + + if (!oform) + oform = "%.3f"; + if (bin_in || bin_out) + emess(1,"binary I/O not available in -V option"); + for (;;) { + ++emess_dat.File_line; + if (!(s = fgets(line, MAX_LINE, fid))) + break; + if (!strchr(s, '\n')) { /* overlong line */ + int c; + (void)strcat(s, "\n"); + /* gobble up to newline */ + while ((c = fgetc(fid)) != EOF && c != '\n') ; + } + if (*s == tag) { /* pass on data */ + (void)fputs(s, stdout); + continue; + } + /* check to override default input mode */ + if (*s == 'I' || *s == 'i') { + linvers = 1; + ++s; + } else if (*s == 'I' || *s == 'i') { + linvers = 0; + ++s; + } else + linvers = inverse; + if (linvers) { + if (!PJ_INVERS(Proj)) { + emess(-1,"inverse for this projection not avail.\n"); + continue; + } + dat_xy.u = strtod(s, &s); + dat_xy.v = strtod(s, &s); + if (dat_xy.u == HUGE_VAL || dat_xy.v == HUGE_VAL) { + emess(-1,"lon-lat input conversion failure\n"); + continue; + } + if (prescale) { dat_xy.u *= fscale; dat_xy.v *= fscale; } + dat_ll = pj_inv(dat_xy, Proj); + } else { + dat_ll.u = dmstor(s, &s); + dat_ll.v = dmstor(s, &s); + if (dat_ll.u == HUGE_VAL || dat_ll.v == HUGE_VAL) { + emess(-1,"lon-lat input conversion failure\n"); + continue; + } + dat_xy = pj_fwd(dat_ll, Proj); + if (postscale) { dat_xy.u *= fscale; dat_xy.v *= fscale; } + } + if (pj_errno) { + emess(-1, pj_strerrno(pj_errno)); + continue; + } + if (!*s && (s > line)) --s; /* assumed we gobbled \n */ + if (pj_factors(dat_ll, Proj, 0., &facs)) { + emess(-1,"failed to conpute factors\n\n"); + continue; + } + if (*s != '\n') + (void)fputs(s, stdout); + (void)fputs("Longitude: ", stdout); + (void)fputs(rtodms(pline, dat_ll.u, 'E', 'W'), stdout); + (void)printf(" [ %.11g ]\n", dat_ll.u * RAD_TO_DEG); + (void)fputs("Latitude: ", stdout); + (void)fputs(rtodms(pline, dat_ll.v, 'N', 'S'), stdout); + (void)printf(" [ %.11g ]\n", dat_ll.v * RAD_TO_DEG); + (void)fputs("Easting (x): ", stdout); + (void)printf(oform, dat_xy.u); putchar('\n'); + (void)fputs("Northing (y): ", stdout); + (void)printf(oform, dat_xy.v); putchar('\n'); + (void)printf("Meridian scale (h)%c: %.8f ( %.4g %% error )\n", + facs.code & IS_ANAL_HK ? '*' : ' ', facs.h, (facs.h-1.)*100.); + (void)printf("Parallel scale (k)%c: %.8f ( %.4g %% error )\n", + facs.code & IS_ANAL_HK ? '*' : ' ', facs.k, (facs.k-1.)*100.); + (void)printf("Areal scale (s): %.8f ( %.4g %% error )\n", + facs.s, (facs.s-1.)*100.); + (void)printf("Angular distortion (w): %.3f\n", facs.omega * + RAD_TO_DEG); + (void)printf("Meridian/Parallel angle: %.5f\n", + facs.thetap * RAD_TO_DEG); + (void)printf("Convergence%c: ",facs.code & IS_ANAL_CONV ? '*' : ' '); + (void)fputs(rtodms(pline, facs.conv, 0, 0), stdout); + (void)printf(" [ %.8f ]\n", facs.conv * RAD_TO_DEG); + (void)printf("Max-min (Tissot axis a-b) scale error: %.5f %.5f\n\n", + facs.a, facs.b); + } +} + void +main(int argc, char **argv) { + char *arg, **eargv = argv, *pargv[MAX_PARGS], **iargv = argv; + FILE *fid; + int pargc = 0, iargc = argc, eargc = 0, c, mon = 0; + + if (emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) + ++emess_dat.Prog_name; + else emess_dat.Prog_name = *argv; + inverse = ! strncmp(emess_dat.Prog_name, "inv", 3); + if (argc <= 1 ) { + (void)fprintf(stderr, usage, pj_release, emess_dat.Prog_name); + exit (0); + } + /* process run line arguments */ + while (--argc > 0) { /* collect run line arguments */ + if(**++argv == '-') for(arg = *argv;;) { + switch(*++arg) { + case '\0': /* position of "stdin" */ + if (arg[-1] == '-') eargv[eargc++] = "-"; + break; + case 'b': /* binary I/O */ + bin_in = bin_out = 1; + continue; + case 'v': /* monitor dump of initialization */ + mon = 1; + continue; + case 'i': /* input binary */ + bin_in = 1; + continue; + case 'o': /* output binary */ + bin_out = 1; + continue; + case 'I': /* alt. method to spec inverse */ + inverse = 1; + continue; + case 'E': /* echo ascii input to ascii output */ + echoin = 1; + continue; + case 'V': /* very verbose processing mode */ + very_verby = 1; + mon = 1; + case 'S': /* compute scale factors */ + dofactors = 1; + continue; + case 't': /* set col. one char */ + if (arg[1]) tag = *++arg; + else emess(1,"missing -t col. 1 tag"); + continue; + case 'l': /* list projections, ellipses or units */ + if (!arg[1] || arg[1] == 'p' || arg[1] == 'P') { + /* list projections */ + struct PJ_LIST *lp; + int do_long = arg[1] == 'P', c; + char *str; + + for (lp = pj_list ; lp->id ; ++lp) { + (void)printf("%s : ", lp->id); + if (do_long) /* possibly multiline description */ + (void)puts(*lp->descr); + else { /* first line, only */ + str = *lp->descr; + while ((c = *str++) && c != '\n') + putchar(c); + putchar('\n'); + } + } + } else if (arg[1] == '=') { /* list projection 'descr' */ + struct PJ_LIST *lp; + + arg += 2; + for (lp = pj_list ; lp->id ; ++lp) + if (!strcmp(lp->id, arg)) { + (void)printf("%9s : %s\n", lp->id, *lp->descr); + break; + } + } else if (arg[1] == 'e') { /* list ellipses */ + struct PJ_ELLPS *le; + + for (le = pj_ellps; le->id ; ++le) + (void)printf("%9s %-16s %-16s %s\n", + le->id, le->major, le->ell, le->name); + } else if (arg[1] == 'u') { /* list units */ + struct PJ_UNITS *lu; + + for (lu = pj_units; lu->id ; ++lu) + (void)printf("%12s %-20s %s\n", + lu->id, lu->to_meter, lu->name); + } else + emess(1,"invalid list option: l%c",arg[1]); + exit(0); + continue; /* artificial */ + case 'e': /* error line alternative */ + if (--argc <= 0) +noargument: emess(1,"missing argument for -%c",*arg); + oterr = *++argv; + continue; + case 'T': /* generate Chebyshev coefficients */ + if (--argc <= 0) goto noargument; + cheby_str = *++argv; + continue; + case 'm': /* cartesian multiplier */ + if (--argc <= 0) goto noargument; + postscale = 1; + if (!strncmp("1/",*++argv,2) || + !strncmp("1:",*argv,2)) { + if((fscale = atof((*argv)+2)) == 0.) + goto badscale; + fscale = 1. / fscale; + } else + if ((fscale = atof(*argv)) == 0.) { +badscale: + emess(1,"invalid scale argument"); + } + continue; + case 'W': /* specify seconds precision */ + case 'w': /* -W for constant field width */ + if ((c = arg[1]) != 0 && isdigit(c)) { + set_rtodms(c - '0', *arg == 'W'); + ++arg; + } else + emess(1,"-W argument missing or non-digit"); + continue; + case 'f': /* alternate output format degrees or xy */ + if (--argc <= 0) goto noargument; + oform = *++argv; + continue; + case 'r': /* reverse input */ + reversein = 1; + continue; + case 's': /* reverse output */ + reverseout = 1; + continue; + default: + emess(1, "invalid option: -%c",*arg); + break; + } + break; + } else if (**argv == '+') { /* + argument */ + if (pargc < MAX_PARGS) + pargv[pargc++] = *argv + 1; + else + emess(1,"overflowed + argument table"); + } else /* assumed to be input file name(s) */ + eargv[eargc++] = *argv; + } + if (eargc == 0 && !cheby_str) /* if no specific files force sysin */ + eargv[eargc++] = "-"; + else if (eargc > 0 && cheby_str) /* warning */ + emess(4, "data files when generating Chebychev prohibited"); + /* done with parameter and control input */ + if (inverse && postscale) { + prescale = 1; + postscale = 0; + fscale = 1./fscale; + } + if (!(Proj = pj_init(pargc, pargv))) + emess(3,"projection initialization failure\ncause: %s", + pj_strerrno(pj_errno)); + if (inverse) { + if (!Proj->inv) + emess(3,"inverse projection not available"); + proj = pj_inv; + } else + proj = pj_fwd; + if (cheby_str) { + extern void gen_cheb(int, UV(*)(), char *, PJ *, int, char **); + + gen_cheb(inverse, int_proj, cheby_str, Proj, iargc, iargv); + exit(0); + } + /* set input formating control */ + if (mon) { + pj_pr_list(Proj); + if (very_verby) { + (void)printf("#Final Earth figure: "); + if (Proj->es) { + (void)printf("ellipsoid\n# Major axis (a): "); + (void)printf(oform ? oform : "%.3f", Proj->a); + (void)printf("\n# 1/flattening: %.6f\n", + 1./(1. - sqrt(1. - Proj->es))); + (void)printf("# squared eccentricity: %.12f\n", Proj->es); + } else { + (void)printf("sphere\n# Radius: "); + (void)printf(oform ? oform : "%.3f", Proj->a); + (void)putchar('\n'); + } + } + } + if (inverse) + informat = strtod; + else { + informat = dmstor; + if (!oform) + oform = "%.2f"; + } + /* process input file list */ + for ( ; eargc-- ; ++eargv) { + if (**eargv == '-') { + fid = stdin; + emess_dat.File_name = "<stdin>"; + } else { + if ((fid = fopen(*eargv, "r")) == NULL) { + emess(-2, *eargv, "input file"); + continue; + } + emess_dat.File_name = *eargv; + } + emess_dat.File_line = 0; + if (very_verby) + vprocess(fid); + else + process(fid); + (void)fclose(fid); + emess_dat.File_name = 0; + } + exit(0); /* normal completion */ +} diff --git a/src/projects.h b/src/projects.h new file mode 100644 index 00000000..7f4a30c3 --- /dev/null +++ b/src/projects.h @@ -0,0 +1,240 @@ +/* General projections header file */ +#ifndef PROJECTS_H +#define PROJECTS_H + +#ifndef lint +static const char PROJECTS_H_ID[] = "@(#)projects.h 4.11 95/09/23 GIE REL"; +#endif + /* standard inclusions */ +#include <math.h> +#include <stdlib.h> + /* maximum path/filename */ +#ifndef MAX_PATH_FILENAME +#define MAX_PATH_FILENAME 1024 +#endif + /* prototype hypot for systems where absent */ +extern double hypot(double, double); + /* some useful constants */ +#define HALFPI 1.5707963267948966 +#define FORTPI 0.78539816339744833 +#define PI 3.14159265358979323846 +#define TWOPI 6.2831853071795864769 +#define RAD_TO_DEG 57.29577951308232 +#define DEG_TO_RAD .0174532925199432958 + +/* environment parameter name */ +#ifndef PROJ_LIB +#define PROJ_LIB "PROJ_LIB" +#endif +/* maximum tag id length for +init and default files */ +#ifndef ID_TAG_MAX +#define ID_TAG_MAX 50 +#endif + +/* directory delimiter for DOS support */ +#ifdef DOS +#define DIR_CHAR '\\' +#else +#define DIR_CHAR '/' +#endif + +typedef struct { double u, v; } UV; +typedef struct { double r, i; } COMPLEX; + +#ifndef PJ_LIB__ +#define XY UV +#define LP UV +#else +typedef struct { double x, y; } XY; +typedef struct { double lam, phi; } LP; +#endif + + extern int /* global error return code */ +pj_errno; + +typedef union { double f; int i; char *s; } PVALUE; + +struct PJ_LIST { + char *id; /* projection keyword */ + void *(*proj)(); /* projection entry point */ + char * const *descr; /* description text */ +}; +struct PJ_ELLPS { + char *id; /* ellipse keyword name */ + char *major; /* a= value */ + char *ell; /* elliptical parameter */ + char *name; /* comments */ +}; +struct PJ_UNITS { + char *id; /* units keyword */ + char *to_meter; /* multiply by value to get meters */ + char *name; /* comments */ +}; +struct FACTORS { + struct DERIVS { + double x_l, x_p; /* derivatives of x for lambda-phi */ + double y_l, y_p; /* derivatives of y for lambda-phi */ + } der; + double h, k; /* meridinal, parallel scales */ + double omega, thetap; /* angular distortion, theta prime */ + double conv; /* convergence */ + double s; /* areal scale factor */ + double a, b; /* max-min scale error */ + int code; /* info as to analytics, see following */ +}; +#define IS_ANAL_XL_YL 01 /* derivatives of lon analytic */ +#define IS_ANAL_XP_YP 02 /* derivatives of lat analytic */ +#define IS_ANAL_HK 04 /* h and k analytic */ +#define IS_ANAL_CONV 010 /* convergence analytic */ + /* parameter list struct */ +typedef struct ARG_list { + struct ARG_list *next; + char used; + char param[1]; } paralist; + /* base projection data structure */ +typedef struct PJconsts { + XY (*fwd)(LP, struct PJconsts *); + LP (*inv)(XY, struct PJconsts *); + void (*spc)(LP, struct PJconsts *, struct FACTORS *); + void (*pfree)(struct PJconsts *); + const char *descr; + paralist *params; /* parameter list */ + int over; /* over-range flag */ + int geoc; /* geocentric latitude flag */ + double + a, /* major axis or radius if es==0 */ + e, /* eccentricity */ + es, /* e ^ 2 */ + ra, /* 1/A */ + one_es, /* 1 - e^2 */ + rone_es, /* 1/one_es */ + lam0, phi0, /* central longitude, latitude */ + x0, y0, /* easting and northing */ + k0, /* general scaling factor */ + to_meter, fr_meter; /* cartesian scaling */ +#ifdef PROJ_PARMS__ +PROJ_PARMS__ +#endif /* end of optional extensions */ +} PJ; + +/* Generate pj_list external or make list from include file */ +#ifndef PJ_LIST_H +extern struct PJ_LIST pj_list[]; +#else +#define PROJ_HEAD(id, name) \ + extern void *pj_##id(); extern char * const pj_s_##id; +#ifndef lint +#define DO_PJ_LIST_ID +#endif +#include PJ_LIST_H +#ifndef lint +#undef DO_PJ_LIST_ID +#endif +#undef PROJ_HEAD +#define PROJ_HEAD(id, name) {#id, pj_##id, &pj_s_##id}, + struct PJ_LIST +pj_list[] = { +#include PJ_LIST_H + {0, 0, 0}, + }; +#undef PROJ_HEAD +#endif + +#ifndef PJ_ELLPS__ +extern struct PJ_ELLPS pj_ellps[]; +#endif + +#ifndef PJ_UNITS__ +extern struct PJ_UNITS pj_units[]; +#endif + +#ifdef PJ_LIB__ + /* repeatative projection code */ +#define PROJ_HEAD(id, name) static const char des_##id [] = name +#define ENTRYA(name) const char * const pj_s_##name = des_##name; \ + PJ *pj_##name(PJ *P) { if (!P) { \ + if (P = pj_malloc(sizeof(PJ))) { \ + P->pfree = freeup; P->fwd = 0; P->inv = 0; \ + P->spc = 0; P->descr = des_##name; +#define ENTRYX } return P; } else { +#define ENTRY0(name) ENTRYA(name) ENTRYX +#define ENTRY1(name, a) ENTRYA(name) P->a = 0; ENTRYX +#define ENTRY2(name, a, b) ENTRYA(name) P->a = 0; P->b = 0; ENTRYX +#define ENDENTRY(p) } return (p); } +#define E_ERROR(err) { pj_errno = err; freeup(P); return(0); } +#define E_ERROR_0 { freeup(P); return(0); } +#define F_ERROR { pj_errno = -20; return(xy); } +#define I_ERROR { pj_errno = -20; return(lp); } +#define FORWARD(name) static XY name(LP lp, PJ *P) { XY xy +#define INVERSE(name) static LP name(XY xy, PJ *P) { LP lp +#define FREEUP static void freeup(PJ *P) { +#define SPECIAL(name) static void name(LP lp, PJ *P, struct FACTORS *fac) +#endif +#define MAX_TAB_ID 80 +typedef struct { float lam, phi; } FLP; +typedef struct { int lam, phi; } ILP; +struct CTABLE { + char id[MAX_TAB_ID]; /* ascii info */ + LP ll; /* lower left corner coordinates */ + LP del; /* size of cells */ + ILP lim; /* limits of conversion matrix */ + FLP *cvs; /* conversion matrix */ +}; + /* procedure prototypes */ +double dmstor(const char *, char **); +void set_rtodms(int, int); +char *rtodms(char *, double, int, int); +double adjlon(double); +double aacos(double), aasin(double), asqrt(double), aatan2(double, double); +PVALUE pj_param(paralist *, char *); +paralist *pj_mkparam(char *); +int pj_ell_set(paralist *, double *, double *); +double *pj_enfn(double); +double pj_mlfn(double, double, double, double *); +double pj_inv_mlfn(double, double, double *); +double pj_qsfn(double, double, double); +double pj_tsfn(double, double, double); +double pj_msfn(double, double, double); +double pj_phi2(double, double); +double pj_qsfn_(double, PJ *); +double *pj_authset(double); +double pj_authlat(double, double *); +COMPLEX pj_zpoly1(COMPLEX, COMPLEX *, int); +COMPLEX pj_zpolyd1(COMPLEX, COMPLEX *, int, COMPLEX *); +int pj_deriv(LP, double, PJ *, struct DERIVS *); +int pj_factors(LP, PJ *, double, struct FACTORS *); +XY pj_fwd(LP, PJ *); +LP pj_inv(XY, PJ *); +void pj_pr_list(PJ *); +void pj_free(PJ *); +PJ *pj_init(int, char **); +void *pj_malloc(size_t); +void pj_dalloc(void *); +char *pj_strerrno(int); +/* Approximation structures and procedures */ +typedef struct { /* Chebyshev or Power series structure */ + UV a, b; /* power series range for evaluation */ + /* or Chebyshev argument shift/scaling */ + struct PW_COEF {/* row coefficient structure */ + int m; /* number of c coefficients (=0 for none) */ + double *c; /* power coefficients */ + } *cu, *cv; + int mu, mv; /* maximum cu and cv index (+1 for count) */ + int power; /* != 0 if power series, else Chebyshev */ +} Tseries; +Tseries *mk_cheby(UV, UV, double, UV *, UV (*)(UV), int, int, int); +UV bpseval(UV, Tseries *); +UV bcheval(UV, Tseries *); +UV biveval(UV, Tseries *); +void *vector1(int, int); +void **vector2(int, int, int); +int bchgen(UV, UV, int, int, UV **, UV(*)(UV)); +int bch2bps(UV, UV, UV **, int, int); +/* nadcon related protos */ +LP nad_intr(LP, struct CTABLE *); +LP nad_cvt(LP, int, struct CTABLE *); +struct CTABLE *nad_init(char *); +void nad_free(struct CTABLE *); +extern char const pj_release[]; + +#endif /* end of basic projections header */ diff --git a/src/rtodms.c b/src/rtodms.c new file mode 100644 index 00000000..8af7e7b5 --- /dev/null +++ b/src/rtodms.c @@ -0,0 +1,73 @@ +/* Convert radian argument to DMS ascii format */ +#ifndef lint +static const char SCCSID[]="@(#)rtodms.c 4.3 93/06/12 GIE REL"; +#endif +#include <projects.h> +#include <stdio.h> +#include <string.h> +/* +** RES is fractional second figures +** RES60 = 60 * RES +** CONV = 180 * 3600 * RES / PI (radians to RES seconds) +*/ + static double +RES = 1000., +RES60 = 60000., +CONV = 206264806.24709635515796003417; + static char +format[50] = "%dd%d'%.3f\"%c"; + static int +dolong = 0; + void +set_rtodms(int fract, int con_w) { + int i; + + if (fract >= 0 && fract < 9 ) { + RES = 1.; + /* following not very elegant, but used infrequently */ + for (i = 0; i < fract; ++i) + RES *= 10.; + RES60 = RES * 60.; + CONV = 180. * 3600. * RES / PI; + if (! con_w) + (void)sprintf(format,"%%dd%%d'%%.%df\"%%c", fract); + else + (void)sprintf(format,"%%dd%%02d'%%0%d.%df\"%%c", + fract+2+(fract?1:0), fract); + dolong = con_w; + } +} + char * +rtodms(char *s, double r, int pos, int neg) { + int deg, min, sign; + char *ss = s; + double sec; + + if (r < 0) { + r = -r; + if (!pos) { *ss++ = '-'; sign = 0; } + else sign = neg; + } else + sign = pos; + r = floor(r * CONV + .5); + sec = fmod(r / RES, 60.); + r = floor(r / RES60); + min = fmod(r, 60.); + deg = r / 60.; + if (dolong) + (void)sprintf(ss,format,deg,min,sec,sign); + else if (sec) { + char *p, *q; + + (void)sprintf(ss,format,deg,min,sec,sign); + for (q = p = ss + strlen(ss) - (sign ? 3 : 2); *p == '0'; --p) ; + if (*p != '.') + ++p; + if (++q != p) + (void)strcpy(p, q); + } else if (min) + (void)sprintf(ss,"%dd%d'%c",deg,min,sign); + else + (void)sprintf(ss,"%dd%c",deg, sign); + return s; +} diff --git a/src/strtod.c b/src/strtod.c new file mode 100644 index 00000000..1a6b3e19 --- /dev/null +++ b/src/strtod.c @@ -0,0 +1,151 @@ +#ifndef lint +static const char SCCSID[]="@(#)strtod.c 4.5 93/12/03 GIE REL"; +#endif +/* THIS CODE HAS BEEN MODIFIED from the distribution made by the FSF. +** However, "licensing" and header information are retained. +*/ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <errno.h> +#include <float.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +/* Convert NPTR to a double. If ENDPTR is not NULL, a pointer to the + character after the last one used in the number is put in *ENDPTR. */ +#ifdef DOS +typedef int wchar_t; +#ifndef NULL +#define NULL 0 +#endif +#endif + double +strtod(const char *nptr, char **endptr) { + const char *s; + short int sign; + /* The number so far. */ + double num; + int got_dot; /* Found a decimal point. */ + int got_digit; /* Seen any digits. */ + /* The exponent of the number. */ + long int exponent; + + if (nptr == NULL) { + errno = EINVAL; + goto noconv; + } + s = nptr; + /* Eat whitespace. */ + while (isspace(*s)) + ++s; + /* Get the sign. */ + sign = *s == '-' ? -1 : 1; + if (*s == '-' || *s == '+') + ++s; + num = 0.0; + got_dot = 0; + got_digit = 0; + exponent = 0; + for (; ; ++s) { + if (isdigit (*s)) { + got_digit = 1; + /* Make sure that multiplication by 10 will not overflow. */ + if (num > DBL_MAX * 0.1) + /* The value of the digit doesn't matter, since we have already + gotten as many digits as can be represented in a `double'. + This doesn't necessarily mean the result will overflow. + The exponent may reduce it to within range. + + We just need to record that there was another + digit so that we can multiply by 10 later. */ + ++exponent; + else + num = (num * 10.0) + (*s - '0'); + /* Keep track of the number of digits after the decimal point. + If we just divided by 10 here, we would lose precision. */ + if (got_dot) + --exponent; + } else if (!got_dot && (wchar_t) * s == '.') + /* Record that we have found the decimal point. */ + got_dot = 1; + else + /* Any other character terminates the number. */ + break; + } + if (!got_digit) + goto noconv; + if (tolower(*s) == 'e') { + /* Get the exponent specified after the `e' or `E'. */ + int save = errno; + char *end; + long int exp; + + errno = 0; + ++s; + exp = strtol(s, &end, 10); + if (errno == ERANGE) { + /* The exponent overflowed a `long int'. It is probably a safe + assumption that an exponent that cannot be represented by + a `long int' exceeds the limits of a `double'. */ + if (endptr != NULL) + *endptr = end; + if (exp < 0) + goto underflow; + else + goto overflow; + } else if (end == s) + /* There was no exponent. Reset END to point to + the 'e' or 'E', so *ENDPTR will be set there. */ + end = (char *) s - 1; + errno = save; + s = end; + exponent += exp; + } + if (endptr != NULL) + *endptr = (char *) s; + if (num == 0.0) + return 0.0; + /* Multiply NUM by 10 to the EXPONENT power, + checking for overflow and underflow. */ + if (exponent < 0) { + if (num < DBL_MIN * pow(10.0, (double) -exponent)) + goto underflow; + } else if (exponent > 0) { + if (num > DBL_MAX * pow(10.0, (double) -exponent)) + goto overflow; + } + num *= pow(10.0, (double) exponent); + return num * sign; +overflow: + /* Return an overflow error. */ + errno = ERANGE; + return HUGE_VAL * sign; +underflow: + /* Return an underflow error. */ + if (endptr != NULL) + *endptr = (char *) nptr; + errno = ERANGE; + return 0.0; +noconv: + /* There was no number. */ + if (endptr != NULL) + *endptr = (char *) nptr; + return 0.0; +} diff --git a/src/vector1.c b/src/vector1.c new file mode 100644 index 00000000..0ca3816b --- /dev/null +++ b/src/vector1.c @@ -0,0 +1,32 @@ +/* make storage for one and two dimensional matricies */ +#ifndef lint +static const char SCCSID[]="@(#)vector1.c 4.4 94/03/22 GIE REL"; +#endif +#include <stdlib.h> +#include <projects.h> + void * /* one dimension array */ +vector1(int nvals, int size) { return((void *)pj_malloc(size * nvals)); } + void /* free 2D array */ +freev2(void **v, int nrows) { + if (v) { + for (v += nrows; nrows > 0; --nrows) + pj_dalloc(*--v); + pj_dalloc(v); + } +} + void ** /* two dimension array */ +vector2(int nrows, int ncols, int size) { + void **s; + + if (s = (void **)pj_malloc(sizeof(void *) * nrows)) { + int rsize, i; + + rsize = size * ncols; + for (i = 0; i < nrows; ++i) + if (!(s[i] = pj_malloc(rsize))) { + freev2(s, i); + return (void **)0; + } + } + return s; +} |
