buffer static method

Polygon buffer(
  1. {required Geometry geometry,
  2. required double distance}
)

Creates a buffer polygon at the specified distance around the given geometry. This is a planar buffer operation. Use GeometryEngine.bufferGeodetic to produce geodetic buffers.

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

Supports true curves as input, producing a densified curve as output where applicable.

Parameters:

  • geometry — A geometry object.
  • distance — The distance to buffer the geometry. It must be in the same units as the geometry's spatial reference.

Return Value: A polygon object that represents a buffer at the desired distance relative to the given geometry.

Implementation

static Polygon buffer(
    {required Geometry geometry, required double distance}) {
  _initializeArcGISEnvironmentIfNeeded();
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_buffer(
        geometry._handle, distance, errorHandler);
  });
  return Polygon._fromHandle(objectHandle)!;
}