difference static method

Geometry difference(
  1. {required Geometry geometry1,
  2. required Geometry geometry2}
)

Constructs the set-theoretic difference between two geometries.

This method returns a geometry consisting of the parts of geometry1 that are not in geometry2. It performs a spatial subtraction from the two input geometries. The order of the two input geometry arguments produces different results if they are switched. Think of the difference equation as:

A (Difference) B != B (Difference) A

Use GeometryEngine.symmetricDifference to get the parts that are in either geometry, but not in both.

Supports true curves.

Parameters:

  • geometry1 — A geometry object.
  • geometry2 — The second geometry of dimension equal to or greater than the elements of the first geometry.

Return Value: A new geometry object that represents the difference of the two given input geometries.

Implementation

static Geometry difference(
    {required Geometry geometry1, required Geometry geometry2}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_difference(
        geometry1._handle, geometry2._handle, errorHandler);
  });
  return Geometry._fromHandle(objectHandle)!;
}