equalsWithTolerance method

bool equalsWithTolerance(
  1. {required Geometry right,
  2. required double tolerance}
)

Checks if two geometries are approximately the same within the given tolerance.

This function performs a lightweight comparison of two geometries that might be useful when writing test code. It uses the tolerance to compare each of x, y, and any other values the geometries possess (such as z or m) independently in the manner: abs(value1 - value2) <= tolerance. The single tolerance value is used even if the x, y, z or m units differ. This function does not respect modular arithmetic of spatial references which wrap around, so longitudes of -180 and +180 degrees are considered to differ by 360 degrees.

Returns true if the difference of each is within the tolerance and all other properties of the geometries are exactly equal (such as spatial reference and vertex count). Returns false if an error occurs.

For topological equality, use a relational operator such as GeometryEngine.equals.

Parameters:

  • right — The second geometry.
  • tolerance — The tolerance.

Return Value: True if the geometries are equal, within the tolerance, otherwise false.

Implementation

bool equalsWithTolerance(
    {required Geometry right, required double tolerance}) {
  return _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_Geometry_equalsWithTolerance(
        _handle, right._handle, tolerance, errorHandler);
  });
}