##
``

### 2.6 Coordinate Transformations

`The purpose of Geotiff is to allow the definitive identification of georeferenced locations within a raster dataset. This is generally accomplished through tying raster space coordinates to a model space coordinate system, when no further information is required. In the GeoTIFF nomenclature, "georeferencing" refers to tying raster space to a model space M, while "geocoding" refers to defining how the model space M assigns coordinates to points on the earth.

The three tags defined below may be used for defining the relationship between R and M, and the relationship may be diagrammed as:

`

               ModelPixelScaleTag
               ModelTiepointTag
        R  ------------ OR --------------> M
      (I,J,K)  ModelTransformationTag   (X,Y,Z)

`

The next section describes these Baseline georeferencing tags in detail.

`

#### 2.6.1 GeoTIFF Tags for Coordinate Transformations

`For most common applications, the transformation between raster and model space may be defined with a set of raster-to-model tiepoints and scaling parameters. The following two tags may be used for this purpose:

`

    ModelTiepointTag:
          Tag = 33922 (8482.H)
          Type = DOUBLE (IEEE Double precision)
          N = 6*K,  K = number of tiepoints
          Alias: GeoreferenceTag
          Owner: Intergraph

`

This tag stores raster->model tiepoint pairs in the order

`

            ModelTiepointTag = (...,I,J,K, X,Y,Z...),

`

where (I,J,K) is the point at location (I,J) in raster space with pixel-value K, and (X,Y,Z) is a vector in model space. In most cases the model space is only two-dimensional, in which case both K and Z should be set to zero; this third dimension is provided in anticipation of future support for 3D digital elevation models and vertical coordinate systems.

A raster image may be georeferenced simply by specifying its location, size and orientation in the model coordinate space M. This may be done by specifying the location of three of the four bounding corner points. However, tiepoints are only to be considered exact at the points specified; thus defining such a set of bounding tiepoints does not imply that the model space locations of the interior of the image may be exactly computed by a linear interpolation of these tiepoints.

However, since the relationship between the Raster space and the model space will often be an exact, affine transformation, this relationship can be defined using one set of tiepoints and the "ModelPixelScaleTag", described below, which gives the vertical and horizontal raster grid cell size, specified in model units.

If possible, the first tiepoint placed in this tag shall be the one establishing the location of the point (0,0) in raster space. However, if this is not possible (for example, if (0,0) is goes to a part of model space in which the projection is ill-defined), then there is no particular order in which the tiepoints need be listed.

For orthorectification or mosaicking applications a large number of tiepoints may be specified on a mesh over the raster image. However, the definition of associated grid interpolation methods is not in the scope of the current GeoTIFF spec.

Remark: As mentioned in section 2.5.1, all GeoTIFF information is independent of the XPosition, YPosition, and Orientation tags of the standard TIFF 6.0 spec.

The next two tags are optional tags provided for defining exact affine transformations between raster and model space; baseline GeoTIFF files may use either, but shall never use both within the same TIFF image directory.

`

    ModelPixelScaleTag:
          Tag = 33550
          Type = DOUBLE (IEEE Double precision)
          N = 3
          Owner: SoftDesk

`

This tag may be used to specify the size of raster pixel spacing in the model space units, when the raster space can be embedded in the model space coordinate system without rotation, and consists of the following 3 values:

`

        ModelPixelScaleTag = (ScaleX, ScaleY, ScaleZ)

`

where ScaleX and ScaleY give the horizontal and vertical spacing of raster pixels. The ScaleZ is primarily used to map the pixel value of a digital elevation model into the correct Z-scale, and so for most other purposes this value should be zero (since most model spaces are 2-D, with Z=0).

A single tiepoint in the ModelTiepointTag, together with this tag, completely determine the relationship between raster and model space; thus they comprise the two tags which Baseline GeoTIFF files most often will use to place a raster image into a "standard position" in model space.

Like the Tiepoint tag, this tag information is independent of the XPosition, YPosition, Resolution and Orientation tags of the standard TIFF 6.0 spec. However, simple reversals of orientation between raster and model space (e.g. horizontal or vertical flips) may be indicated by reversal of sign in the corresponding component of the ModelPixelScaleTag. GeoTIFF compliant readers must honor this sign-reversal convention.

This tag must not be used if the raster image requires rotation or shearing to place it into the standard model space. In such cases the transformation shall be defined with the more general ModelTransformationTag, defined below.

`

    ModelTransformationTag
          Tag  =  34264  (85D8.H)
          Type =  DOUBLE
          N    =  16
          Owner: JPL Cartographic Applications Group

`

This tag may be used to specify the transformation matrix between the raster space (and its dependent pixel-value space) and the (possibly 3D) model space. If specified, the tag shall have the following organization:

`

          ModelTransformationTag = (a,b,c,d,e....m,n,o,p).

`

where

`

            model                              image
            coords =          matrix     *     coords

``

            |-   -|     |-                 -|  |-   -|
            |  X  |     |   a   b   c   d   |  |  I  |
            |     |     |                   |  |     |
            |  Y  |     |   e   f   g   h   |  |  J  |
            |     |  =  |                   |  |     |
            |  Z  |     |   i   j   k   l   |  |  K  |
            |     |     |                   |  |     |
            |  1  |     |   m   n   o   p   |  |  1  |
            |-   -|     |-                 -|  |-   -|

`

By convention, and without loss of generality, the following parameters are currently hard-coded and will always be the same (but must be specified nonetheless):

`

           m = n = o = 0,  p = 1.

`

For Baseline GeoTIFF, the model space is always 2-D, and so the matrix will have the more limited form:

`

            |-   -|     |-                 -|  |-   -|
            |  X  |     |   a   b   0   d   |  |  I  |
            |     |     |                   |  |     |
            |  Y  |     |   e   f   0   h   |  |  J  |
            |     |  =  |                   |  |     |
            |  Z  |     |   0   0   0   0   |  |  K  |
            |     |     |                   |  |     |
            |  1  |     |   0   0   0   1   |  |  1  |
            |-   -|     |-                 -|  |-   -|

`

Values "d" and "h" will often be used to represent translations in X and Y, and so will not necessarily be zero. All 16 values should be specified, in all cases. Only the raster-to-model transformation is defined; if the inverse transformation is required it must be computed by the client, to the desired accuracy.

This matrix tag should not be used if the ModelTiepointTag and the ModelPixelScaleTag are already defined. If only a single tiepoint (I,J,K,X,Y,Z) is specified, and the ModelPixelScale = (Sx, Sy, Sz) is specified, then the corresponding transformation matrix may be computed from them as:

`

            |-                         -|
            |   Sx    0.0   0.0   Tx    |
            |                           |      Tx = X - I*Sx
            |   0.0  -Sy    0.0   Ty    |      Ty = Y + J*Sy
            |                           |      Tz = Z - K*Sz
            |   0.0   0.0   Sz    Tz    |
            |                           |
            |   0.0   0.0   0.0   1.0   |
            |-                         -|

`

where the -Sy is due the reversal of direction from J increasing- down in raster space to Y increasing-up in model space.

Like the Tiepoint tag, this tag information is independent of the XPosition, YPosition, and Orientation tags of the standard TIFF 6.0 spec.

Note: In Revision 0.2 and earlier, another tag was used for this matrix, which has been renamed as follows:

`

    IntergraphMatrixTag
          Tag  =  33920  (8480.H)
          Type =  DOUBLE
          N    =  17 (Intergraph implementation) or 16 (GeoTIFF 0.2 impl.)
          Owner: Intergraph

`

This tag conflicts with an internal software implementation at Intergraph, and so its use is no longer encouraged. A GeoTIFF reader should look first for the new tag, and only if it is not found should it check for this older tag. If found, it should only consider it to be contain valid GeoTIFF matrix information if the tag-count is 16; the Intergraph version uses 17 values.

`

#### 2.6.2 Coordinate Transformation Data Flow

``

    The dataflow of the various GeoTIFF parameter datasets is based upon the EPSG/POSC configuration. Here is the text of the description accompanying the EPSG parameter tables:
    The data files (.CSV) have a hierarchical structure:

     +---------------------------+   +----------------------------+
     |           VERTCS          |   |           PROJCS           |
     +---------------------------+   +----------------------------+
     |Vertical Coordinate Systems|   |Projected Coordinate Systems|
     +-------------+-------------+   +------------+---------------+
                   |                              |
          +--------+                              |
          |                                       |
          |            +--------------------------+
          |            |                          |
          |            |            +-------------+---------------+
          |            |            |            GEOGCS           |
          |            |            +-----------------------------+
          |            |            |Geographic Coordinate Systems|
          |            |            |Geocentric Coordinate Systems|
          |            |            +-----------------------------+
          |            |            |       Geodetic Datums       |
          |            |            +-------------+---------------+
          |            |                          |
          |            |                 +--------+-------+
          |            |                 |                |
          |     +------+-----+    +------+-----+   +------+-------+
          |     |    PROJ    |    |   ELLIPS   |   |    PMERID    |
          |     +------------+    +------------+   +--------------+
          |     | Projection |    | Ellipsoid  |   |Prime Meridian|
          |     | Parameters |    | Parameters |   |  Parameters  |
          |     +------+-----+    +------+-----+   +------+-------+
          |            |                 |                |
          +------------+-----------+-----+----------------+
                                   |
                     +-------------+------------+
                     |           UNITS          |
                     +--------------------------+
                     | Linear and Angular Units |
                     +--------------------------+

     The parameter listings are "living documents" and will be
     updated by the EPSG from time to time. Any comment or
     suggestions for improvements should be directed to:

       Jean-Patrick Girbig,      or   Roger Lott,
       Manager Cartography,           Head of Survey,
       Petroconsultants S.A.,         BP Exploration,
       PO Box 152,                    Uxbridge One,
       24 Chemin de la Marie,         Harefield Road,
       1258 Perly-Geneva,             Uxbridge,
       Switzerland.                   Middlesex UB8 1PD,
                                      England.

                                      Internet:
                                       lottrj@txpcap.hou.xwh.bp.com

     Requests for the inclusion of new data should include supporting
     documentation.  Requests for changing existing data should include
     reference to both the name and code of the item.

`

`

#### 2.6.3 Cookbook for Defining Transformations

    Here is a 4-step guide to producing a set of Baseline GeoTIFF tags for defining coordinate transformation information of a raster dataset.

      Step 1: Establish the Raster Space coordinate system used:
              RasterPixelIsArea or RasterPixelIsPoint.

      Step 2: Establish/define the model space Type in which the image is
              to be georeferenced. Usually this will be a Projected
              Coordinate system (PCS). If you are geocoding this data
              set, then the model space is defined to be the corresponding
              geographic, geocentric or Projected coordinate system (skip
              to the "Cookbook"  section 2.7.3 first to do determine this).

      Step 3: Identify the nature of the transformations needed to tie
              the raster data down to the model space coordinate system:

         Case 1: The model-location of a raster point (x,y) is known, but not
              the scale or orientations:

                Use the ModelTiepointTag to define the (X,Y,Z) coordinates
                of the known raster point.

         Case 2: The location of three non-collinear raster points are known
              exactly, but the linearity of the transformation is not known.

              Use the ModelTiepointTag to define the (X,Y,Z) coordinates
              of all three known raster points. Do not compute or define the
              ModelPixelScale or ModelTransformation tag.

         Case 3: The position and scale of the data is known exactly, and
              no rotation or shearing is needed to fit into the model space.

              Use the ModelTiepointTag to define the (X,Y,Z) coordinates
              of the known raster point, and the ModelPixelScaleTag to
              specify the scale.

         Case 4: The raster data requires rotation and/or lateral shearing to
              fit into the defined model space:

              Use the ModelTransformation matrix to define the transformation.

         Case 5: The raster data cannot be fit into the model space with a
              simple affine transformation (rubber-sheeting required).

              Use only the ModelTiepoint tag, and specify as many
              tiepoints as your application requires. Note, however, that
              this is not a Baseline GeoTIFF implementation, and should
              not be used for interchange; it is recommended that the image be
              geometrically rectified first, and put into a standard projected
              coordinate system.
       Step 4: Install the defined tag values in the TIFF file and close it.

`

`