GeoBox class

A geographic bounding box with west, south, east and north values.

West and east represents geographic longitude coordinates values. South and north represents geographic latitude coordinates values.

For geographic bounding boxes (west-longitude, south-latitude) position represents the most southwesterly point, and (east-longitude, north-latitude) position represents the more northeasterly point. When a bounding box spans the antimeridian, it's possible that "min-longitude" (west) is larger than "max-longitude" (east) as a number. See also RFC 7946 chapter 5 about bounding boxes in GeoJSON for reference.

Optional minElev and maxElev for 3D boxes, and minM and maxM for measured boxes can be provided too.

Supported coordinate value combinations by coordinate type:

Type Bounding box 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
Inheritance
Available extensions
Annotations
  • @immutable

Constructors

GeoBox({required double west, required double south, double? minElev, double? minM, required double east, required double north, double? maxElev, double? maxM})
A geographic bounding box with west, south, east and north values.
const
GeoBox.build(Iterable<num> coords, {int offset = 0, Coords? type})
Builds a geographic bounding box from coords starting from offset.
factory
GeoBox.create({required double minX, required double minY, double? minZ, double? minM, required double maxX, required double maxY, double? maxZ, double? maxM})
A bounding box from parameters compatible with CreateBox function type.
const
GeoBox.from(Iterable<Geographic> positions)
A minimum bounding box calculated from positions.
factory
GeoBox.parse(String text, {Pattern delimiter = ',', Coords? type, bool swapXY = false})
Parses a geographic bounding box from text.
factory
GeoBox.parseDms({DmsFormat format = const Dms(), required String west, required String south, String? minElev, String? minM, required String east, required String north, String? maxElev, String? maxM})
Parses a geographic bounding box from west, south, east and north values that are formatted as specified (and parsed) by format.
factory

Properties

coordinateDimension int
The number of coordinate values (2, 3 or 4) on a position.
no setteroverride
corners2D Iterable<Geographic>
Returns all distinct (in 2D) corners for this axis aligned bounding box.
no setteroverride
east double
The east coordinate as geographic longitude.
no setter
hashCode int
The hash code for this object.
no setteroverride
height double
The height of the bounding box, equals to maxY - minY.
no setteroverride
is3D bool
True for 3D positions (with z or elevation coordinate).
no setteroverride
isMeasured bool
True if a measure value is available (or the m coordinate for a position).
no setteroverride
max Geographic
The "east-north" geographic position of this bounding box.
no setteroverride
maxElev double?
The maximum elevation (or altitude) coordinate in meters optionally.
no setter
maxM double?
The maximum m coordinate optionally. Returns null if not available.
no setteroverride
maxX double
The maximum x (or east) coordinate.
no setteroverride
maxY double
The maximum y (or north) coordinate.
no setteroverride
maxZ double?
The maximum z coordinate optionally. Returns null if not available.
no setteroverride
min Geographic
The "west-south" geographic position of this bounding box.
no setteroverride
minElev double?
The minimum elevation (or altitude) coordinate in meters optionally.
no setter
minM double?
The minimum m coordinate optionally. Returns null if not available.
no setteroverride
minX double
The minimum x (or west) coordinate.
no setteroverride
minY double
The minimum y (or south) coordinate.
no setteroverride
minZ double?
The minimum z coordinate optionally. Returns null if not available.
no setteroverride
north double
The north coordinate as geographic latitude.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
south double
The south coordinate as geographic latitude.
no setter
spatialDimension int
The number of spatial coordinate values (2 for 2D or 3 for 3D) on a position.
no setteroverride
type Coords
The coordinate type.
no setteroverride
values Iterable<double>
Coordinate values of this bounding box as an iterable of 4, 6 or 8 items.
no setterinherited
west double
The west coordinate as geographic longitude.
no setter
width double
The width of the bounding box, equals to maxX - minX.
no setteroverride

Methods

aligned2D([Aligned align = Aligned.center]) Geographic
Returns an aligned 2D position relative to this box.
override
copyByType(Coords type) GeoBox
Copies this bounding box as another box by the given coordinate type.
override
copyTo<R extends Box>(CreateBox<R> factory) → R
Copies this box to a new box created by the factory.
inherited
copyWith({double? minX, double? minY, double? minZ, double? minM, double? maxX, double? maxY, double? maxZ, double? maxM}) GeoBox
Copies this box with optional attributes overriding values.
override
eastDms([DmsFormat format = const Dms()]) String
Formats east according to format.
equals2D(Box other, {double toleranceHoriz = defaultEpsilon}) bool
True if this box equals with other by testing 2D coordinates only.
inherited
equals3D(Box other, {double toleranceHoriz = defaultEpsilon, double toleranceVert = defaultEpsilon}) bool
True if this box equals with other by testing 3D coordinates only.
inherited
intersects(Box other) bool
Returns true if this bounding box intesects with other box.
inherited
intersects2D(Box other) bool
Returns true if this bounding box intersects with other box in 2D.
inherited
intersectsPoint(Position point) bool
Returns true if this bounding box intesects with point.
inherited
intersectsPoint2D(Position point) bool
Returns true if this bounding box intesects with point in 2D.
inherited
northDms([DmsFormat format = const Dms()]) String
Formats north according to format.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
project(Projection projection) ProjBox
Projects this geographic bounding box to a projected box using the forward projection.
override
southDms([DmsFormat format = const Dms()]) String
Formats south according to format.
toString() String
A string representation of this object.
inherited
toText({String delimiter = ',', int? decimals, bool swapXY = false}) String
Returns coordinate values as a string separated by delimiter.
inherited
valuesByType(Coords type) Iterable<double>
Coordinate values of this bounding box as an iterable of 4, 6 or 8 items according to the given type.
inherited
westDms([DmsFormat format = const Dms()]) String
Formats west according to format.

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

fromBox(Box source) GeoBox
Creates a geographic bounding box by copying coordinates from source.