Package org.gdal.osr

## Class CoordinateTransformation

- java.lang.Object
- - org.gdal.osr.CoordinateTransformation

-     public class CoordinateTransformation
      extends java.lang.Object

  Object for transforming between coordinate systems.

  The CoordinateTransformation class is a binding for the C++ OGRCoordinateTransformation class.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CoordinateTransformation​(SpatialReference src, SpatialReference dst)` | Deprecated.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static CoordinateTransformation` | `CreateCoordinateTransformation​(SpatialReference src, SpatialReference dst)` | Create transformation object.
    `void` | `delete​()` |
    `void` | `TransformPoint​(double[] inout)` | Transform point from source to destination space.
    `void` | `TransformPoint​(double[] argout, double x, double y)` | Transform point from source to destination space.
    `void` | `TransformPoint​(double[] argout, double x, double y, double z)` | Transform point from source to destination space.
    `double[]` | `TransformPoint​(double x, double y)` | Transform point from source to destination space.
    `double[]` | `TransformPoint​(double x, double y, double z)` | Transform point from source to destination space.
    `void` | `TransformPoints​(double[][] pointArray)` | Transform points from source to destination space.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CoordinateTransformation

          public CoordinateTransformation​(SpatialReference src,
                                          SpatialReference dst)

      Deprecated.
      Create transformation object.

      Caution: the coordinate transformation object returned can be in a non working state if no coordinate transformation can be established between src and dst, and calling other methods on it can result in the process termination. If using GDAL 1.10 or above, it is recommended to use the CreateCoordinateTransformation(org.gdal.osr.SpatialReference, org.gdal.osr.SpatialReference) method instead.

      For GDAL 1.9.X or below, you might use the following snippet :

           gdal.PushErrorHandler( "CPLQuietErrorHandler" );
           hTransform = new CoordinateTransformation(src, dst);
           gdal.PopErrorHandler();
           if (gdal.GetLastErrorMsg().indexOf("Unable to load PROJ.4 library") != -1)
              hTransform = null;

      Parameters:
        `src` - source spatial reference system.
        `dst` - target spatial reference system.
      See Also:
        `CreateCoordinateTransformation(org.gdal.osr.SpatialReference, org.gdal.osr.SpatialReference)`

  - ### Method Detail

    - #### delete

          public void delete​()

    - #### TransformPoint

          public double[] TransformPoint​(double x,
                                         double y,
                                         double z)

      Transform point from source to destination space.
      Parameters:
        `x` - input x value
        `y` - input y value
      Returns:
        the transformed coordinates
      Since:
        Java bindings 1.7.0

    - #### TransformPoint

          public double[] TransformPoint​(double x,
                                         double y)

      Transform point from source to destination space.
      Parameters:
        `x` - input x value
        `y` - input y value
      Returns:
        the transformed coordinates
      Since:
        Java bindings 1.7.0

    - #### CreateCoordinateTransformation

          public static CoordinateTransformation CreateCoordinateTransformation​(SpatialReference src,
                                                                                SpatialReference dst)

      Create transformation object.
      Parameters:
        `src` - source spatial reference system.
        `dst` - target spatial reference system.
      Returns:
        a new CoordinateTransformation object, or null in case of failure
      Since:
        GDAL 1.10

    - #### TransformPoint

          public void TransformPoint​(double[] inout)

      Transform point from source to destination space.

      The provided array will be modified in place.

      Parameters:
        `inout` - an array of 3 doubles

    - #### TransformPoint

          public void TransformPoint​(double[] argout,
                                     double x,
                                     double y,
                                     double z)

      Transform point from source to destination space.
      Parameters:
        `argout` - array of 3 double values where the transformed coordinates will be put.
        `x` - input x value
        `y` - input y value
        `z` - input z value

    - #### TransformPoint

          public void TransformPoint​(double[] argout,
                                     double x,
                                     double y)

      Transform point from source to destination space.
      Parameters:
        `argout` - array of 3 double values where the transformed coordinates will be put.
        `x` - input x value
        `y` - input y value
      Since:
        Java bindings 1.7.0

    - #### TransformPoints

          public void TransformPoints​(double[][] pointArray)

      Transform points from source to destination space.

      The provided array will be modified in place.

      Parameters:
        `pointArray` - an array of coordinates. Each coordinate can be either 2D or 3D