GeoBox.from constructor
GeoBox.from(
- Iterable<
Geographic> positions
A minimum bounding box calculated from positions
.
Throws FormatException if cannot create (ie. positions
is empty).
Examples:
// a 2D box (lon: 10.0 .. 15.0, lat: 20.0 .. 25.0)
GeoBox.from(
const [
Geographic(lon: 10.0, lat: 20.0),
Geographic(lon: 15.0, lat: 25.0),
],
);
// a 3D box (lon: 10.0 .. 15.0, lat: 20.0 .. 25.0, elev: 30.0 .. 35.0)
GeoBox.from(
const [
Geographic(lon: 10.0, lat: 20.0, elev: 30.0),
Geographic(lon: 15.0, lat: 25.0, elev: 35.0),
],
);
// a measured 2D box (lon: 10.0..15.0, lat: 20.0..25.0, m: 40.0..45.0)
GeoBox.from(
const [
Geographic(lon: 10.0, lat: 20.0, m: 40.0),
Geographic(lon: 15.0, lat: 25.0, m: 45.0),
],
);
// 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.from(
const [
Geographic(lon: 10.0, lat: 20.0, elev: 30.0, m: 40.0),
Geographic(lon: 15.0, lat: 25.0, elev: 35.0, m: 45.0),
],
);
Implementation
factory GeoBox.from(Iterable<Geographic> positions) =>
Box.createBoxFrom(positions, GeoBox.create);