GCTP()
Fortran version:
SUBROUTINE GTPZ0( CRDIN, INSYS, INZONE, TPARIN, INUNIT,
& INSPH, IPR, JPR, LEMSG, LPARM, CRDIO,
& IOSYS, IOZONE, TPARIO, IOUNIT,
& LN27, LN83, FN27, FN83, LENGTH, IFLG )
REAL*8 CRDIN( 2 )
INTEGER INSYS
INTEGER INZONE
REAL*8 TPARIN( 15 )
INTEGER INUNIT
INTEGER INSPH
INTEGER IPR
INTEGER JPR
INTEGER LEMSG
INTEGER LPARM
REAL*8 CRDIO( 2 )
INTEGER IOSYS
INTEGER IOZONE
REAL*8 TPARIO( 15 )
INTEGER IOUNIT
INTEGER LN27
INTEGER LN83
CHARACTER*128 FN27
CHARACTER*128 FN83
INTEGER LENGTH
INTEGER IFLG
Summary:
GTPZ0() is the primary access routine to the US Geological
Survey National Mapping Division's General Cartographic
Transformation Package (GCTP), a system of computer subroutines written
in FORTRAN, designed to permit the transformation of coordinate
pairs from one map projection to another. The GCTP is the
standard computer software used by the National Mapping Division for
map projection computations. The mathematical algorithms used in
GCTP meet the accuracy specifications of USGS Circular 878-B,
"Representation of Geographic Point Locations for Information
Interchange" which has been proposed as Federal Information
Processing Standards Publication 70-1.
Here is the USGS PDF document for GCTP.
For Fortran-90 declarations and interface checking, for
I/O API-3.1 and earlier:
USE M3UTILIO
For I/O API-3.2 and later:
USE MODGCTP
in which case MODULE MODGCTP
also provides routines
that set up the (admittedly-complex) argument lists for
GTPZ0()
, and which use that routine for a number of
common modeling related tasks.
Preconditions:
none
Fortran Usage
CALL GTPZ0( CRDIN, INSYS, INZONE, TPARIN, INUNIT, INSPH,
& IPR, JPR, LEMSG, LPARM, CRDIO, IOSYS, IOZONE,
& TPARIO, IOUNIT, LN27, LN83, FN27, FN83, LENGTH,
& IFLG )
where
- CRDIN( 2 )
- REAL*8 array of two input coordinates (X-Y,
longitude-latitude, etc.). The nature of the coordinates
is defined by INSYS, INZONE, and INUNIT. The east-west
dimension (X, longitude, easting) is first, followed by
the north-south (Y, latitude, northing)
Sign conventions: Latitude--North is plus, south is
minus; Longitude--East is plus, west is minus
- INSYS
- INTEGER*4 input projection system code:
- 0 for Geographic (default)
- 1 for Universal Transverse Mercator
- 2 for State Plane Coordinates
- 3 for Albers Conical Equal-Area
- 4 for Lambert Conformal Conic
- 5 for Mercator
- 6 for Polar Stereographic
- 7 for Polyconic
- 8 for Equidistant Conic
- 9 for Transverse Mercator
- 10 for Stereographic
- 11 for Lambert Azimuthal Equal-Area
- 12 for Azimuthal Equidistant
- 13 for Gnomonic
- 14 for Orthographic
- 15 for General Vertical Near-Side Perspective
- 16 for Sinusoidal
- 17 for Equirectangular
- 18 for Miller Cylindrical
- 19 for Van der Grinten
- 20 for Oblique Mercator
- 21 for Robinson
- 22 for Space Oblique Mercator
- 23 for Modified Stereographic Conformal (Alaska)
- INZONE
- INTEGER*4 input zone code number for the Universal
Transverse Mercator (UTM) when INSYS=1, and for the
State Plane Coordinates System when INSYS=2. For the
UTM in the SouthernHemisphere, INZONE must be
negative. When INSYS=0, INZONE is not relevant for
Geographic coordinates. When INSYS is greater than
2, the use of a non-zero INZONE associates that
number with the set of parameters that is input. If
the INZONE value remains unchanged with subsequent
calls, the parameters are reused (the same zone
definition is used) without reinitialization of the
projection.
- TPARIN( 15 )
- REAL*8 array of 15 input projection parameters. If INSYS
is greater than 2, this array must be provided by the
calling program. Note that all longitudes and
latitudes in the parameter array are assumed to be in
the standard packed DMS format (+DDDMMMSSS.SSS).
Interpretations of TPARIN entries for standard
EDSS/Models-3 projections are given below:
- Lat-Lon (INSYS = 0): TPARIN unused
- Albers Conical Equal-Area (INSYS = 3),
Lambert Conformal Conic (INSYS = 4):
TPARIN( 1:8 ) used:
- Semimajor axis of ellipsoid. If 0, meters
used.
- Eccentricity squared of ellipsoid. If 0,
assume sphere. If > 1, interpreted as
semiminor axis of ellipsoid
- Latitude of 1st standard parallel
- Latitude of 2nd standard parallel
- Longitude of the central meridian
- Latitude of the origin of projection
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- Equatorial Mercator (INSYS = 5): TPARIN( 1 ) and
TPARIN( 5:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- Longitude of the central meridian
- Latitude of the true scale
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- Polar Stereographic (INSYS = 6): TPARIN( 1 ) and
TPARIN( 5:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- Longitude of the central meridian
- Latitude of the origin
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- Transverse Mercator (INSYS = 9): TPARIN( 1 ) and
TPARIN( 5:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- Longitude of the central meridian
- Latitude of the true scale
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- (Oblique) Mercator (INSYS = 20): TPARIN( 1:8 )
used:
- Semimajor axis of ellipsoid (default Clarke
1866)
- Eccentricity squared (0 for sphere). >1
for semiminor axis
- Scale factor at center of the projection
- Azimuthal angle E of N of center line
- Longitude point on line where azimuth is
measured
- Latitude of the origin of the projection
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- Polar Stereographic (INSYS = 6): TPARIN( 1 ) and
TPARIN( 5:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- Longitude of the central meridian
- Latitude of the true scale
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- General Stereographic (INSYS = 10): TPARIN( 1 ) and
TPARIN( 5:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- Longitude of the center of the projection
- Latitude of the center of the projection
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- Lambert Azimuthal Equal Area (INSYS = 11): TPARIN( 1 ) and
TPARIN( 5:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- Longitude of the center of the projection
- Latitude of the center of the projection
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- Sinusoidal Equal Area (INSYS = 16): TPARIN( 1 ) and
TPARIN( 6:8 ) used.
- Radius of sphere of reference
- (unused)
- (unused)
- (unused)
- (unused)
- Latitude of the center of the projection
- False easting in the same units as the
semimajor axis
- False northing in the same units as the
semimajor axis
- (unused)...
- INUNIT
- INTEGER*4 input units code for the values in array CRDIN:
- 0 for radians
- 1 for U.S. feet
- 2 for meters
- 3 for seconds of arc
- 4 for degrees of arc
- 5 for International ft.
- 6 for table supplying the unit code, which is
legislated for theState zone selected
- INSPH
- INTEGER*4 input-output spheroid code from the following
list:
- 0 for Clarke 1866
- 1 for Clarke 1880
- 2 for Bessel
- 3 for New International 1967
- 4 for International 1909
- 5 for WGS 72
- 6 for Everest
- 7 for WGS 66
- 8 for GRS 1980
- 9 for Airy
- 10 for Modified Everest
- 11 for Modified Airy
- 12 for WGS 84
- 13 for Southeast Asia
- 14 for Australian National
- 15 for Krassovsky
- 16 for Hough
- 17 for Mercury 1960
- 18 for Modified Mercury 1968
- 19 for Normal Sphere
If the user wishes to supply constants for a spheroid
other than those above, a negative INSPH value must be
used, and the semimajor axis and semiminor axis or
eccentricity squared must be supplied in TPARIN and
TPARIO.
- IPR
- INTEGER*4 printout flag for printing error messages. If
IPR is zero, error messages will be printed on logical
unit LEMSG. If IPR is not zero, error messages will not
be printed
- JPR
- INTEGER*4 printout flag for printing projection parameters. If
JPR is zero, projection parameters will be printed on logical
unit LPARM. If JPR is not zero, projection parameters will not
be printed
- LEMSG
- logical unit number where error messages will be printed.
- LPARM
- INTEGER*4 logical unit number where projection parameters
will be printed.
- CRDIO( 2 )
- REAL*8 output array of the transformed coordinates.
See CRDIN for explanation.
- IOSYS
- INTEGER*4 output projection system code.
See INSYS for explanation.
- IOZONE
- INTEGER*4 output zone number.
See INZONE for explanation
- TPARIO
- REAL*8 array of 15 parameters for the output projection.
See TPARIN for explanation.
- IOUNIT
- INTEGER*4 output units code.
See INUNIT for explanation.
- LN27
- INTEGER*4 logical unit number of the direct access file
where the NAD 1927 State Plane zone parameters are
located. Used only when INSYS=2; must be opened by
caller.
- LN83
- INTEGER*4 logical unit number of the direct access file
where the NAD 1983 State Plane zone parameters are
located. Used only when INSYS=2; must be opened by
caller.
- FN27
- CHARACTER*128 file name of the direct access file
containing the NAD 1927 State Plane zone parameters.
- FN83
- CHARACTER*128 file name of the direct access file
containing the NAD 1983 State Plane zone parameters.
- LENGTH
- INTEGER*4 record length of direct access files FN27 and
FN83. For the Amdahl, Con current, and Gould computers,
LENGTH is 108 bytes. For VAX computers, LENGTH is 27
words. See your Fortran-77 manual for interpretation of
direct access Fortran UNFOMATTED file record lengths.
- IFLG
- INTEGER*4 error flag after the transformation:
- 0 for: No errors
- 1 for: INSYS is illegal
- 2 for: IOSYS is illegal
- 3 for: INUNIT is illegal
- 4 for: IOUNIT is illegal
- 5 for: INSYS and INUNIT inconsistent
- 6 for: IOSYS and IOUNIT inconsistent
- 7 for: INZONE is illegal
- 8 for: IOZONE is illegal
- 11 for: INUNIT or IOUNIT is illegal
- 12 for: INUNIT and IOUNIT are inconsistent
- other: the error flag has been
set by one of the projection subroutines.
C Usage
On most systems it is safe to assume that the Fortran GTPZ0 routine
can be called either as "gtpz0_()" (for most Unix
systems), "gtpz0() " (for IBM AIX and HP HP-UX systems),
or "GTPZ0() " (for Cray systems). Arguments should be
passed by reference:
/* FUNCTION PROTOTYPE: */
#if __hpux || _AIX
#define GTPZ0 gtpz0
#elif _CRAY
/* don't need to do anything */
#else
#define GTPZ0 gtpz0_
#endif
void GTPZ0( double CRDIN[ 2 ],
int *INSYS, /* DO NOT USE 2 (STATE PLANE) */
int *INZONE,
double TPARIN[ 15 ],
int *INUNIT,
int *INSPH,
int *IPR,
int *JPR,
int *LEMSG,
int *LPARM,
double CRDIO[ 2 ],
int *IOSYS, /* DO NOT USE 2 (STATE PLANE) */
int *IOZONE,
double TPARIO[ 15 ],
int *IOUNIT,
int *LN27,
int *LN83,
char FN27[ 128 ],
char FN83[ 128 ],
int *LENGTH,
int *IFLG )
...
Previous: GCD
Previous: DSCGRID
Next: LAMBERT
Next: GETDATE
Up: Coordinate and Grid Related Routines
Up: Utility Routines
To: Models-3/EDSS I/O API: The Help Pages