bufferGeodeticCollection static method

List<Polygon> bufferGeodeticCollection(
  1. {required List<Geometry> geometries,
  2. required List<double> distances,
  3. LinearUnit? distanceUnit,
  4. required double maxDeviation,
  5. required GeodeticCurveType curveType,
  6. required bool unionResult}
)

Creates and returns a geodetic buffer or buffers relative to the given collection of geometries.

Geodetic buffers account for the actual shape of the earth. Distances are calculated between points on a curved surface (the geoid) as opposed to points on a flat surface (the Cartesian plane).

Negative distance can be used to create buffers inside polygons. Using a negative buffer distance shrinks the polygons' boundaries by the distance specified. Note that if the negative buffer distance is large enough, polygons may collapse to empty geometries.

Parameters:

  • geometries — A collection of geometries.
  • distances — The distance to buffer each geometry, expressed as a List of double. If the size of the distances array is less than the number of geometries, the last distance value is used for the rest of geometries.
  • distanceUnit — The unit of measure for the distance.
  • maxDeviation — The maximum deviation between points. If NaN then a maximum deviation of up to 0.2% of the buffer distance, with a maximum of 0.01 meters, aiming to give an output geometry with a smooth boundary.
  • curveType — The GeodeticCurveType used to calculate the buffer.
  • unionResult — Return a single geometry that buffers all the geometries (true), or one buffer for each in the given collection (false).

Return Value: A collection of polygon geometries that represent a geodetic buffer at the desired distance(s) relative to the given geometries. If 'unionResult' is true, the resulting collection contains a single polygon. If geometries is empty, returns an empty array.

Implementation

static List<Polygon> bufferGeodeticCollection(
    {required List<Geometry> geometries,
    required List<double> distances,
    LinearUnit? distanceUnit,
    required double maxDeviation,
    required GeodeticCurveType curveType,
    required bool unionResult}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreGeometries =
      geometries.toMutableArray(valueType: _ElementType.geometry);
  final coreDistances =
      distances.toMutableArray(valueType: _ElementType.float64);
  final arrayHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_bufferGeodeticCollection(
        coreGeometries._handle,
        coreDistances._handle,
        distanceUnit?._handle ?? ffi.nullptr,
        maxDeviation,
        curveType.coreValue,
        unionResult,
        errorHandler);
  });
  return arrayHandle.toList();
}