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. This method can be used to replicate the former (prior to version 100.9.0) behavior of the TransformationCatalog.getTransformation and TransformationCatalog.getTransformation methods:

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);
}