GeometryCollection<E extends Geometry> constructor

GeometryCollection<E extends Geometry>(
  1. List<E> geometries, {
  2. Coords? type,
  3. Box? bounds,
})

A geometry collection with geometries and optional bounds.

An optional type specifies the coordinate type of geometry objects in a collection. When not provided, the type can be resolved from objects.

Examples:

GeometryCollection([
  // a point with a 2D position
  Point([10.0, 20.0].xy),

  // a point with a 3D position
  Point([10.0, 20.0, 30.0].xyz),

  // a line string from three 3D positions
  LineString.from([
    [10.0, 20.0, 30.0].xyz,
    [12.5, 22.5, 32.5].xyz,
    [15.0, 25.0, 35.0].xyz,
  ])
]);

Implementation

GeometryCollection(List<E> geometries, {Coords? type, super.bounds})
    : _geometries = geometries,
      _coordType = type ?? resolveCoordTypeFrom(collection: geometries);