GeoBox.build constructor

GeoBox.build(
  1. Iterable<num> coords, {
  2. int offset = 0,
  3. Coords? type,
})

Builds a geographic bounding box from coords starting from offset.

Supported coordinate value combinations by coordinate type:

Type Expected values
xy west, south, east, north
xyz west, south, minElev, east, north, maxElev
xym west, south, minM, east, north, maxM
xyzm west, south, minElev, minM, east, north, maxElev, maxM

Use an optional type to explicitely set the coordinate type. If not provided and coords has 6 items, then xyz coordinates are assumed.

Throws FormatException if coordinates are invalid.

Examples:

// a 2D box (lon: 10.0 .. 15.0, lat: 20.0 .. 25.0)
GeoBox.build([10.0, 20.0, 15.0, 25.0]);

// a 3D box (lon: 10.0 .. 15.0, lat: 20.0 .. 25.0, elev: 30.0 .. 35.0)
GeoBox.build([10.0, 20.0, 30.0, 15.0, 25.0, 35.0]);

// a measured 2D box (lon: 10.0..15.0, lat: 20.0..25.0, m: 40.0..45.0)
// (need to specify the coordinate type XYM)
GeoBox.build([10.0, 20.0, 40.0, 15.0, 25.0, 45.0], type: Coords.xym);

// a measured 3D box
// (lon: 10.0..15.0, lat: 20.0..25.0, elev: 30.0..35.0, m: 40.0..45.0)
GeoBox.build([10.0, 20.0, 30.0, 40.0, 15.0, 25.0, 35.0, 45.0]);

Implementation

factory GeoBox.build(
  Iterable<num> coords, {
  int offset = 0,
  Coords? type,
}) =>
    Box.buildBox(
      coords,
      to: GeoBox.create,
      offset: offset,
      type: type,
    );