User's Guide

TRANCOORD

Converts coordinates from one coordinate system to another

Function:

Converts coordinates from one coordinate system to another. Coordinate conversions may be performed between any of the projections supported by the LAS projection transformation package or with a polynomial (up to fourth order). An option exists to grid the resulting coordinates to image coordinates given a set of framing parameters.

Parameters:

Subcommand -PROJ:
Converts projection coordinates. Converts coordinates from one projection coordinate system to another using the LAS projection transformation package.

IN(--)
Input image. This file specifies an image DDR file from which output projection information is read. If this parameter is not NULL, the output projection information is read from the DDR instead of using OPROJKEY and INPROJ. Windowing is ignored.

INTS(--)
Input tie point selection file. This file contains coordinates which are to be transformed. The unit of measure of the coordinates is specified in the file header record. Refer to the User Notes for instructions for using ASCII or labeled table files as input to TRANCOORD. If this parameter is NULL, the user is prompted for coordinate values.

INPROJ(--)
Input projection definition file. This file contains projection-related information describing the image projection. INPROJ can contain more than one set of projection parameters for input and output. IPROJKEY and OPROJKEY specify the projection to be used. If there are two sets of projection parameters with the same projection key, the first one is used. If INPROJ is NULL, both INTS and IN must be specified.

INPROJ is generated by PROJPRM and a description of the file may be found in the LAS Programmer's Manual. INPROJ is a labeled table file and the format has limited flexibility. It must have attributes of PROJKEY, PROJTYPE, PROJZONE, PROJUNITS, PROJSPH, and PROJPARMS.

IPROJKEY(--)
Input projection key. The key of the projection system in INPROJ which describes the input coordinate system. When the null value is given, input projection information is read from the header record of the input tie point selection file, INTS. The header record must be valid. If INTS is NULL, INPROJ and IPROJKEY must be specified.

OPROJKEY(--)
Output projection key. The key of the projection system in INPROJ which describes the output coordinate system. If IN is specified, the output projection information is read from the image DDR instead of using INPROJ and OPROJKEY. If IN is NULL, INPROJ and OPROJKEY must be specified.

OUTTS(--)
Output tie point selection file. This tie point selection file contains transformed coordinates. The unit of measure of the coordinates is described in the file header record. Refer to the User Notes for instructions for getting ASCII or labeled table files as output from TRANCOORD.

PRINT(TERM)
Output destination. The destination of the output.

  = --:        No Report
  = TERM:      Terminal.  Output is sent to the user's 
               terminal.
  = LP:        Line printer.  Output is sent to the 
               printer defined by $PRINTER.
  = Filename:  User-supplied filename.  Output is sent 
               to the user-supplied file with the ex-
               tension ".prt".
Subcommand -GRID:
Converts projection coordinates and frame to user-specified grid. Converts coordinates from one projection coordinate system to another using the LAS projection transformation package. Framing parameters are entered, allowing gridding of the transformed space into image coordinates of user-specified size.

IN(--)
Input image. This file specifies an image DDR file from which output projection and framing information is read. If this parameter is not NULL, this DDR information is used instead of the OPROJKEY, PIXSIZ, COORS, COORUNIT, LSCOORS, NL, and NS parameters. Windowing is ignored.

INTS(--)
Input tie point selection file. This file contains coordinates which are to be transformed. The unit of measure of the coordinates is specified in the file header record. Refer to the User Notes for instructions for using ASCII or labeled table files as input to TRANCOORD. If INTS and INFILE are NULL, the user is prompted for coordinate values.

INTS(--)
Input tie point selection file. This file contains coordinates which are to be transformed. The unit of measure of the coordinates is specified in the file header record. Refer to the User Notes for instructions for using ASCII or labeled table files as input to TRANCOORD. If this parameter is NULL, the user is prompted for coordinate values.

INFILE(--)
Input file. This ASCII file contains tie point coordinates in lines of data consisting of the tie point id, the latitude, and the longitude, separated by whitespace. This file name must be entered using the host naming convention.

INPROJ(--)
Input projection definition file. This file contains projection-related information describing the image projection. INPROJ can contain more than one set of projection parameters for input and output. IPROJKEY and OPROJKEY specify the projection to be used. If there are two sets of projection parameters with the same projection key, the first one is used. If INPROJ is NULL, both INTS and IN must be specified.

INPROJ is generated by PROJPRM and a description of the file may be found in the LAS Programmer's Manual. INPROJ is a labeled table file and the format has limited flexibility. It must have attributes of PROJKEY, PROJTYPE, PROJZONE, PROJUNITS, PROJSPH, and PROJPARMS.

IPROJKEY(--)
Input projection key. The key of the projection system in INPROJ which describes the input coordinate system. When the null value is given, input projection information is read from the header record of the input tie point selection file, INTS. The header record must be valid. If INTS is NULL, INPROJ and IPROJKEY must be specified.

OPROJKEY(--)
Output projection key. The key of the projection system in INPROJ which describes the output coordinate system. If IN is specified, the output projection information is read from the image DDR instead of using INPROJ and OPROJKEY. If IN is NULL, INPROJ and OPROJKEY must be specified.

OUTTS(--)
Output tie point selection file. This tie point selection file contains transformed coordinates and the line, sample coordinates from the gridding process. The unit of measure of the coordinates is described in the file header record. Refer to the User Notes for instructions for getting ASCII or labeled table files as output from TRANCOORD.

PIXSIZ(--)
Pixel dimensions. PIXSIZ defines the dimension of each pixel in the transformed coordinate space. The first value is the dimension in the line (Y) direction, and the second value is the dimension in the sample (X) direction; both dimensions have the same unit of measure as the output coordinates, which is specified in the projection definition file. If IN is specified, the pixel size is read from the image DDR and PIXSIZ is ignored. Likewise, if PIXSIZ is NULL, IN must be specified.

COORS(--)
Coordinates. These coordinates are used to define the frame of the output area for the process of gridding the output area to line, sample coordinates. If NULL, it is assumed that IN was specified and the corner coordinates in the DDR are used. Coordinates are entered as Y (latitude or northing) , X (longitude or easting). Three different modes of processing are possible:


o  When four values are specified and COORUNIT = DMS, 
   RAD, SEC, or DEG, the the upper-left corner and 
   lower-right corner of a geographic input space is 
   defined.  These corner coordinates, along with the 
   pixel dimensions make up the framing parameters.  
   The framing parameters are projected into the speci-
   fied output projection space, and minimums and maxi-
   mums in X and Y are recorded along the boarders of 
   the projected space.  These minimums and maximums are 
   used to define the boundaries of the output space.

o  When four values are specified and COORUNIT = PRO, a 
   coordinate somewhere within the output space frame 
   and the lower-right corner coordinate in the output 
   projection space are given.  The first coordinate 
   is paired with the LSCOOR parameter and is adjusted 
   internally to pixel 1,1.  These coordinates are the 
   minimum and maximums in X and Y and are used to de-
   fine the boundaries of the output space.

o  When two values are specified and COORUNIT = PRO, a
   coordinate somewhere within the output space frame 
   is given.  This coordinate is paired with the LSCOOR 
   parameter to determine the upper-left corner coordi-
   nate in the output space.  This mode of processing 
   requires that NL and NS also are given.  When the NL 
   and NS values are combined with the PIXSIZ parameter,
   the lower-right corner of the output space projec-
   tion can be found, giving minimum and maximum coor-
   dinates in X and Y and thus defining the boundaries 
   of the output space.

COORUNIT(DEG)
Coordinate units. The type of units in which COORS is entered.


  = DMS: Deg Min Sec
  = RAD: Radians
  = DEG: Degrees
  = SEC: Seconds
  = PRO: Projection coordinates in output space

LSCOORS(1,1)
Line/sample coordinates. The image coordinates of the first coordinate pair entered in COORS when projection parameters are being specified directly. The default is to the upper-left corner of the output image space (1,1).

NL(--)
Number of lines. The number of lines in the output area, specified when only the first projection coordinate pair is given in COORS.

NS(--)
Number of samples. The number of samples in the output area, specified when only the first projection coordinate pair is given in COORS.

PRINT(TERM)
Output destination. The destination of the output.

  = --:        No Report
  = TERM:      Terminal.  Output is sent to the user's 
               terminal.
  = LP:        Line printer.  Output is sent to the 
               printer defined by $PRINTER.
  = Filename:  User-supplied filename.  Output is sent 
               to the user-supplied file with the ex-
               tension ".prt".
Subcommand -POLY:
Converts coordinates with a first, second, third, or fourth order polynomial. Converts coordinates from one coordinate system to another using a polynomial transformation (up to fourth order), either user entered or as read from a geometric mapping grid file.

INTS(--)
Input tie point selection file. This file contains coordinates which are to be transformed. The unit of measure of the coordinates is specified in the file header record. Refer to the User Notes for instructions for using ASCII or labeled table files as input to TRANCOORD. If this parameter is NULL, the user is prompted for coordinate values.

INGRID(--)
Input grid file. A geometric mapping grid file containing polynomial coefficients. If a value is given for INGRID, coefficients entered in LINECOEF and SAMPCOEF are ignored. If INGRID is NULL, coefficients must be entered in LINECOEF and SAMPCOEF.

OUTTS(--)
Output tie point selection file. This tie point selection file contains transformed coordinates. The unit of measure of the coordinates is described in the file header record. Refer to the User Notes for instructions for getting ASCII or labeled table files as output from TRANCOORD.

COOROPT("XY")
Coordinate option. Specifies which type of coordinates are to be transformed.


  = XY:     Transform geographic/projection/
            user-defined coordinates.
  = IMAGE:  Transform image coordinates.

LINECOEF(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Line coefficients. Coefficients describing the transformation to be applied to the input line coordinates. Up to a fourth order polynomial may be entered. Coefficients should be entered in the following manner:


 LINECOEF(1):   Constant     
 LINECOEF(2):   X           
 LINECOEF(3):   Y          
 LINECOEF(4):   X**2      
 LINECOEF(5):   XY       
 LINECOEF(6):   Y**2    
 LINECOEF(7):   X**3   
 LINECOEF(8):   (X**2)Y      
 LINECOEF(9):   X(Y**2)     
 LINECOEF(10):  Y**3       
 LINECOEF(11):  X**4      
 LINECOEF(12):  (X**3)Y  
 LINECOEF(13):  (X**2)(Y**2) 
 LINECOEF(14):  X(Y**3)     
 LINECOEF(15):  Y**4       

SAMPCOEF(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Sample coefficients. Coefficients describing the transformation to be applied to the input sample coordinates. Up to a fourth order polynomial may be entered. Coefficients should be entered in the following manner:


 SAMPCOEF(1):   Constant     
 SAMPCOEF(2):   X           
 SAMPCOEF(3):   Y          
 SAMPCOEF(4):   X**2      
 SAMPCOEF(5):   XY       
 SAMPCOEF(6):   Y**2    
 SAMPCOEF(7):   X**3   
 SAMPCOEF(8):   (X**2)Y      
 SAMPCOEF(9):   X(Y**2)     
 SAMPCOEF(10):  Y**3       
 SAMPCOEF(11):  X**4      
 SAMPCOEF(12):  (X**3)Y  
 SAMPCOEF(13):  (X**2)(Y**2) 
 SAMPCOEF(14):  X(Y**3)     
 SAMPCOEF(15):  Y**4       

OFFSETS(0,0,0,0)
Offset values. The line and sample offset applied to the input coordinates followed by the line and sample offsets applied to the output coordinates.

PRINT(TERM)
Output destination. The destination of the output.

  = --:        No Report
  = TERM:      Terminal.  Output is sent to the user's 
               terminal.
  = LP:        Line printer.  Output is sent to the 
               printer defined by $PRINTER.
  = Filename:  User-supplied filename.  Output is sent 
               to the user-supplied file with the ex-
               tension ".prt".

Examples:

  1. LAS> trancoord-proj in=-- ints=in.dat inproj=proj.dat iprojkey=-- oprojkey="alber" outts=out.dat print=term

    The projection coordinates stored in IN.DAT are converted from the projection information contained in IN.DAT's header record to the projection with a key field "ALBER." Resulting projection coordinates are written to OUT.DAT. All program output is to the terminal.

  2. LAS> trancoord-grid in=-- ints=in.dat inproj=proj.dat iprojkey="geo" oprojkey="alber" outts=out.dat + pixsiz=(50,50) coors=(41.35,-107.75,37.90,-100.10) coorunit="deg" print=term

    The projection coordinates stored in IN.DAT are converted from geographic coordinates to Albers Equal Area projection coordinates as specified by IPROJKEY and OPROJKEY. (This assumes projection information in the header record of IN.DAT was not valid). A minimum bounding rectangle calculation is performed in the output space to include the region specified by the framing parameters, as described in Method 1 of the Description/Algorithm section. From this, the projection coordinate of pixel (1,1) is determined and all coordinates converted are also gridded into image coordinates. The resulting projection coordinates and the line,sample coordinates are written to OUT.DAT. All program output is to the terminal.

  3. LAS> trancoord-poly ints=-- ingrid=-- outts=out.dat cooropt=xy linecoef=(0.0,0.707107,0.707107) sampcoef=(0.0,0.707107,-0.707107) offsets=(5.0,6.0,7.0,8.0) print=term

    This example shows how a transformation can be supplied by the user. The program prompts for the point names and their coordinates (y,x). The output image coordinates (y',x') are computed from the input coordinates (y,x) as follows:

                 y' = 0.707107(x+6) + 0.707107(y+5) + 7
                 x' = 0.707107(x+6) - 0.707107(y+5) + 8
    

    Note that coordinates are arranged (y,x) to correspond with (line,sample) coordinates.

Description/Algorithm:

A transformation is expressed as a conversion between two coordinate systems. TRANCOORD's three methods of coordinate transformation are described below:

SUBCOMMAND -PROJ

This subcommand performs the conversion of coordinates from one map projection to another. For a list of available map projections, refer to the PROJPRM module.

After reading the input parameters, the parameters of the two map projection coordinate systems are determined. If an input image was specified, the output projection parameters are read from the DDR instead of using INPROJ and OPROJKEY. The input projection parameters will be set using IPROJKEY. If IPROJKEY is NULL, the input projection parameters are read from the header record of the input tie point selection file. If specified, INTS and OUTTS are opened for read and write access. If INTS is not given, input of coordinates is manual through the user's terminal; however, this mode of operation is not available in BATCH mode.

Projection information for input and output coordinate systems is written to the device specified by the PRINT parameter and the projection transformation package is initialized.

Each tie point record is read (either from disk or from the terminal) and the input coordinate extracted. The projection transformation package is called to convert the coordinate from the specified input projection to the specified output projection. The transformed coordinates are then written to OUTTS (if specified) and to the device specified by the PRINT parameter.

After all the coordinate pairs are read, processed, and written to OUTTS, all files are closed and a completion message is displayed.

SUBCOMMAND -GRID

This subcommand performs the conversion of coordinates from one map projection to another and grids the output area to image coordinates. For a list of available map projections, refer to the PROJPRM module.

Input and output projection parameters are obtained as they are in the PROJ subcommand. Input of coordinates, whether from disk or the user's terminal, is also the same.

Three different methods of specifying the output space frame are allowed:

  Method 1:

     o  The user defines the upper-left and lower-right corner
        coordinates of the area of interest in geographic 
        coordinates.  This forms a rectangle in geographic 
        coordinates.

     o  This rectangular space is projected into the output 
        projection coordinate system.  This usually results in 
        a nonrectangular area.

     o  Search the boundaries of this projected area for minimum 
        and maximum X and Y coordinates in the output projection 
        coordinate system.  This forms a minimum bounding 
        rectangle in the output space of the area of interest.

     o  The upper-left corner (the minimum X, maximum Y) is 
        adjusted outward to the next X and Y multiples of the 
        pixel size.  This is an arbitrary step which simplifies 
        the combining of images with different scales.  It does 
        not alter the internal image geometry, it only slightly 
        adjusts the size of the image frame.

     o  The upper-left corner projection coordinate is assigned 
        to image coordinate (1,1) in the gridded output space.  


  Method 2:

     o  The user defines:  

        a.  An output space projection coordinate at some image 
            coordinate defined by LSCOOR.  When LSCOOR defaults 
            to image coordinate (1,1), the output space coordi-
            nate given is the upper-left corner of the output 
            space.  
        b.  The lower-right corner in the output projection 
            space.

     o  TRANCOORD adjusts the first coordinate given to image 
        coordinate (1,1) to get the minimum X and the maximum Y 
        projection coordinate.  The second coordinate pair given 
        is the maximum X and the minimum Y coordinate.  The out-
        put space is now defined.


  Method 3:

     o  The user defines an output space projection coordinate 
        at some image coordinate defined by LSCOOR, as in Method 
        2.

     o  The user enters the number of output image lines and 
        samples.

     o  The coordinate entered is adjusted to image coordinate 
        (1,1) to get the minimum X and the maximum Y projection 
        coordinates.

     o  The maximum X and minimum Y coordinates are calculated 
        using PIXSIZ and the number of lines and samples from 
        the minimum X and maximum Y projection coordinate.

Note that only the upper-left corner (the minimum X, maximum Y) of the output space is needed to grid the area to image coordinates. However, the lower-right corner (maximum X, minimum Y) is necessary to initialize framing information that is needed later in the process of registering an image.

For diagrams and more information on the framing and gridding process, refer to the Geometric Manipulation Package Overview Document, GEOMPOD.

Each tie point record is read (either from disk or from the terminal) and the input coordinate extracted. The projection transformation package is called to convert the coordinate from the specified input projection to the specified output projection. Then--using the projection coordinate of pixel (1,1) and the pixel dimensions--the line, sample coordinates of the point are calculated. The transformed coordinates and resulting image coordinates are then written to OUTTS (if specified) and to the device specified by the PRINT parameter.

After all coordinate pairs are read, processed, and written to OUTTS, all files are closed and a completion message is displayed.

SUBCOMMAND -POLY

This subcommand allows the user to specify the transformation from one coordinate system to another via polynomial coefficients, up to the fourth order. Input and output of coordinates is as it is in the other subcommands, either from/to a disk file or from/to the user's terminal.

For a given polynomial pair F(Y,X), G(Y,X) with input offset (Yo,Xo) and output offset (Yc,Xc), output point coordinates (Y',X') are given by:


   Y' = F(Y - Yo, X - Xo) + Yc

   X' = G(Y - Yo, X - Xo) + Xc

where:

F(Y,X) =  a(1) + a(2)X + a(3)Y + a(4)X**2 + a(5)XY + 
          a(6)Y**2 + a(7)X**3 + a(8)(X**2)Y + a(9)X(Y**2) + 
          a(10)Y**3 + a(11)X**4 + a(12)(X**3)Y + a(13)(X**2)(Y**2) + 
          a(14)X(Y**3) + a(15)Y**4

G(Y,X) =  b(1) + b(2)X + b(3)Y + b(4)X**2 + b(5)XY +
          b(6)Y**2 + b(7)X**3 + b(8)(X**2)Y + b(9)X(Y**2) +
          b(10)Y**3 + b(11)X**4 + b(12)(X**3)Y + b(13)(X**2)(Y**2) + 
          b(14)X(Y**3) + b(15)Y**4

and

   a(1),...a(15) are coefficients in Y (line direction)
   b(1),...b(15) are coefficients in X (sample direction)

This mapping can be used for magnification, translation, rotation, or other transformations.

Nonfatal Error Messages:

  1. [trancoord-warn] Image coords appear to be rotated

    The projection coordinate system may have been rotated from the image coordinate system. If this is true, the output image coordinates from the GRID subcommand will not be correct. Refer to User Note 7.

Fatal Error Messages:

  1. [trancoord-fatal] Fatal error encountered

    The error message that is displayed immediately preceding this message is the specific error encountered. Processing is terminated.

  2. [trancoord-invalid] Framing coordinates are outside limits of the specified units

    The coordinates given exceed the unit boundries. Please re-specify the coordinates.

  3. [trancoord-proj] Source of projection info not fully specified

    The source of the projection information was not specified. If input projection information is not contained in the header record of the input tie point selection file or if an input tie point selection file was not entered, INPROJ and IPROJKEY must be specified. If an input image was not specified, INPROJ and OPROJKEY must be specified.

  4. [trancoord-pixsiz] Pixel size must be specified

    The pixel size must be specified if the IN parameter is not used. Specify the pixel size in PIXSIZ.

  5. [trancoord-frame] Framing coordinates must be specified

    Framing parameters (some combination of COORS, LSCOOR, NL, NS, and COORUNIT) must be specified if an input image was not specified in IN. Correct the error by specifying an image with valid DDR projection information (IN) or by specifying some combination of the parameters above.

  6. [trancoord-noproj] Projection info not available from DDR

    Output projection information was to be read from the input image DDR; however, the DDR contained some invalid information. Correct the DDR information or specify the output projection parameters using INPROJ and OPROJKEY.

  7. [trancoord-inproj] Input projection information not found

    Input projection parameters could not be found. Double check the intended source of the input projection parameters and redefine if necessary.

  8. [trancoord-open] Error opening input file xxx. INFILE should use host naming convention

    The paramter INFILE uses the host naming convention, therefore the filename should be input using the host naming convention.

User Notes:

  1. The PROJPRM routine is used to create a projection definition file.

  2. The LAS projection transformation package incorporates the USGS General Cartographic Transformation Package (GCTP). For a list of available projections, refer to the PROJPRM module.

  3. The routines ASC2TAB and TAB2TIE may be used to convert an ASCII file or a labeled table file containing coordinates to a tie point selection file. TIE2TAB and TAB2ASC may be used to convert a tie point selection file back to a labeled table file or an ASCII file.

  4. For diagrams and more information on the framing and gridding process, refer to the Geometric Manipulation Package Overview Document, GEOMPOD.

  5. For more information on projections and projection transformations, refer to "Map Projections--A Working Manual," U.S. Geological Survey Professional Paper 1395, John P. Snyder, 1987.

  6. Projection coordinates are defined in LAS to be at the center of a pixel.

  7. TRANCOORD-GRID does not create or handle projection coordinate systems which are rotated from the image coordinate system. If the image DDR described by the IN parameter contains such a projection coordinate system (common for TM-P data), the user must obtain the projection coordinates of each image corner (via the DSPDDR module) and place each corner coordinate pair and the corresponding image coordinates in a tie point location file. The POLYFIT module is then used to create a set of polynomial coefficients mapping from projection coordinates to image coordinates. The polynomial is written to a geometric mapping grid file. This grid file may then be input into TRANCOORD-POLY to calculate image coordinates for given projection coordinates.