getTransformation static method

DatumTransformation? getTransformation({
  1. required SpatialReference inputSpatialReference,
  2. required SpatialReference outputSpatialReference,
  3. Envelope? areaOfInterest,
  4. bool ignoreVertical = false,
})

Returns the best usable transformation used to transform between the input and output spatial references, taking into account the area of interest, if specified. Optionally disregards any vertical transformations.

Use this method to determine whether or not any vertical coordinate systems set on the spatial reference parameters should be accounted for in the returned transformation. If you set ignoreVertical to false, this is equivalent to calling TransformationCatalog.getTransformation.

If areaOfInterest is null or Geometry.isEmpty, the returned transformation does not take into account an area of interest, and the best choice for the entire world extent is effectively assumed.

Otherwise, if areaOfInterest does not intersect the area of use of inputSpatialReference, this method returns null.

If the SpatialReference of areaOfInterest differs from inputSpatialReference, then areaOfInterest is reprojected to inputSpatialReference.

Parameters:

  • inputSpatialReference — The spatial reference to use as the input.
  • outputSpatialReference — The spatial reference to use as the output.
  • areaOfInterest — The bounding box of coordinates to be transformed, or null to consider the entire world extent.
  • ignoreVertical — True if TransformationCatalog should ignore any vertical coordinate system set on the inputSpatialReference or outputSpatialReference, and only consider horizontal (geographic) transformations; false otherwise.

Return Value: A DatumTransformation instance that represents the best choice given the parameters. Always returns a usable transformation where DatumTransformation.isMissingProjectionEngineFiles is false. The specific type returned depends on the given value of the ignoreVertical parameter.

Returns null if no transformation is required for the given input parameters, or if no usable transformation is available.

Implementation

static DatumTransformation? getTransformation({
  required SpatialReference inputSpatialReference,
  required SpatialReference outputSpatialReference,
  Envelope? areaOfInterest,
  bool ignoreVertical = false,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore
        .RT_TransformationCatalog_getTransformationWithAreaOfInterestAndIgnoreVertical(
      inputSpatialReference._handle,
      outputSpatialReference._handle,
      areaOfInterest?._handle ?? ffi.nullptr,
      ignoreVertical,
      errorHandler,
    );
  });
  return DatumTransformation._fromHandle(
    objectHandle,
  );
}