MultiPoint.build constructor

MultiPoint.build(
  1. Iterable<Iterable<double>> points, {
  2. Coords type = Coords.xy,
  3. Box? bounds,
})

Builds a multi point geometry from an array of points (each with a position).

Use type to specify the type of coordinates, by default Coords.xy is expected.

An optional bounds can used set a minimum bounding box for a geometry.

Each point is represented by an Iterable<double> instance. Supported coordinate value combinations for positions are: (x, y), (x, y, z), (x, y, m) and (x, y, z, m).

Examples:

// a multi point with three 2D positions
MultiPoint.build(
  [
    [10.0, 20.0],
    [12.5, 22.5],
    [15.0, 25.0],
  ],
  type: Coords.xy,
);

// a multi point with three 3D positions
MultiPoint.build(
  [
    [10.0, 20.0, 30.0],
    [12.5, 22.5, 32.5],
    [15.0, 25.0, 35.0],
  ],
  type: Coords.xyz,
);

Implementation

factory MultiPoint.build(
  Iterable<Iterable<double>> points, {
  Coords type = Coords.xy,
  Box? bounds,
}) =>
    MultiPoint(
      points
          .map(
            (pos) => Position.view(
              pos is List<double> ? pos : toFloatNNList(pos),
              type: type,
            ),
          )
          .toList(growable: false),
      bounds: bounds,
    );