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:
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:

INUNIT
INTEGER*4 input units code for the values in array CRDIN:
INSPH
INTEGER*4 input-output spheroid code from the following list: 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:

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