distance static method

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

Calculates the simple planar (Euclidean) distance between two geometries.

This planar measurement uses 2D Cartesian mathematics to compute the distance. It is based upon the SpatialReference of the input geometries. If the input geometries do not use an 'distance preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

Parameters:

  • geometry1 — A geometry object.
  • geometry2 — Another geometry object.

Return Value: The distance between the two geometries in the same units as the geometry's spatial reference.

Implementation

static double distance(
    {required Geometry geometry1, required Geometry geometry2}) {
  _initializeArcGISEnvironmentIfNeeded();
  return _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_distance(
        geometry1._handle, geometry2._handle, errorHandler);
  });
}