FeatureCollection<E extends Feature<Geometry>> constructor

FeatureCollection<E extends Feature<Geometry>>(
  1. List<E> features, {
  2. Box? bounds,
  3. Map<String, dynamic>? custom,
})

A feature collection with an array of features with optional bounds and custom properties.

Examples:

// a feature collection with two features
FeatureCollection([
  // a feature with an id and a point geometry (2D coordinates)
  Feature<Point>(
    id: '1',
    geometry: Point([10.0, 20.0].xy),
  ),

  // a feature with properties and a line string geometry (3D coordinates)
  Feature<LineString>(
    geometry: LineString(
      // three (x, y, z) positions
      [10.0, 20.0, 30.0, 12.5, 22.5, 32.5, 15.0, 25.0, 35.0]
          .positions(Coords.xyz),
    ),
    // properties for a feature containing JSON Object like data
    properties: {
      'textProp': 'this is property value',
      'intProp': 10,
      'doubleProp': 29.5,
      'arrayProp': ['foo', 'bar'],
    },
  ),
]);

Implementation

FeatureCollection(List<E> features, {super.bounds, super.custom})
    : _features = features,
      _coordType = resolveCoordTypeFrom(collection: features);