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.
    `CoordinateTransformation​(SpatialReference src, SpatialReference dst, CoordinateTransformationOptions options)` |

  - ### 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.
    `static CoordinateTransformation` | `CreateCoordinateTransformation​(SpatialReference src, SpatialReference dst, CoordinateTransformationOptions options)` |
    `void` | `delete()` |
    `CoordinateTransformation` | `GetInverse()` |
    `void` | `TransformBounds​(double[] argout, double minx, double miny, double maxx, double maxy, int densify_pts)` |
    `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.
    `void` | `TransformPoint​(double[] argout, double x, double y, double z, double t)` |
    `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.
    `int[]` | `TransformPointsWithErrorCodes​(double[][] pointArray)` | Transform points from source to destination space.
    `int` | `TransformPointWithErrorCode​(double[] argout, double x, double y, double z, double t)` | Transform point 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)`

    - #### CoordinateTransformation

          public CoordinateTransformation​(SpatialReference src,
                                          SpatialReference dst,
                                          CoordinateTransformationOptions options)

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

    - #### CreateCoordinateTransformation

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

    - #### GetInverse

          public CoordinateTransformation GetInverse()

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

    - #### TransformPoint

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

    - #### TransformPointWithErrorCode

          public int TransformPointWithErrorCode​(double[] argout,
                                                 double x,
                                                 double y,
                                                 double z,
                                                 double t)

      Transform point from source to destination space.
      Parameters:
        `argout` - array of 4 double values where the transformed coordinates will be put.
        `x` - input x value
        `y` - input y value
        `z` - input z value
        `t` - input t value
      Returns:
        the error code. 0 means no error. See osrConstants.PROJ_ERR_xxxxx enumerated code for the possible error codes.
      Since:
        GDAL 3.3 and PROJ 8

    - #### 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, 3D or 4D

    - #### TransformPointsWithErrorCodes

          public int[] TransformPointsWithErrorCodes​(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, 3D or 4D
      Returns:
        an array of integer with the error codes for each coordinate. 0 means no error. See osrConstants.PROJ_ERR_xxxxx enumerated code for the possible error codes.
      Since:
        GDAL 3.3 and PROJ 8

    - #### TransformBounds

          public void TransformBounds​(double[] argout,
                                      double minx,
                                      double miny,
                                      double maxx,
                                      double maxy,
                                      int densify_pts)