BoundingBox

@Serializable(with = BoundingBoxSerializer::class)
class BoundingBox : Iterable<Double> (source)

Represents an area bounded by a northeast and southwest.

A GeoJsonObject MAY have a member named "bbox" to include information on the coordinate range for its Geometry objects, Feature objects, or FeatureCollection objects.

When serialized, a BoundingBox is represented as an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the northeasterly point. The axes order of a BoundingBox follows the axes order of geometries.

For the BoundingBox to be serialized in 3D form, both Position objects must have a defined altitude.

See RFC 7946 Section 5 for the full specification.

Constructors

Link copied to clipboard
constructor(west: Double, south: Double, east: Double, north: Double)

Construct a 2D BoundingBox from west, south, east, and north coordinates.

constructor(west: Double, south: Double, minAltitude: Double, east: Double, north: Double, maxAltitude: Double)

Construct a 3D BoundingBox from west, south, east, north coordinates with altitude bounds.

constructor(southwest: Position, northeast: Position)

Construct a BoundingBox from two Position objects that represent the southwest corner and northeast corners.

constructor(west: Double, south: Double, minAltitude: Double, east: Double, north: Double, maxAltitude: Double, vararg additionalElements: Double)

Construct a BoundingBox with more than the standard three axes (longitude, latitude, altitude) per corner.

Types

Link copied to clipboard
object Companion

Factory methods for creating and serializing BoundingBox objects.

Properties

Link copied to clipboard

The eastern longitude boundary.

Link copied to clipboard
@get:JvmName(name = "hasAltitude")
val hasAltitude: Boolean

Whether this bounding box has altitude bounds.

Link copied to clipboard

The maximum altitude boundary, or null if this bounding box is 2D.

Link copied to clipboard

The minimum altitude boundary, or null if this bounding box is 2D.

Link copied to clipboard

The northern latitude boundary.

Link copied to clipboard

The northeastern corner of the BoundingBox

Link copied to clipboard
val size: Int

The number of elements in the coordinates array.

Link copied to clipboard

The southern latitude boundary.

Link copied to clipboard

The southwestern corner of the BoundingBox

Link copied to clipboard

The western longitude boundary.

Functions

Link copied to clipboard
operator fun component1(): Position

Destructuring component for southwest.

Link copied to clipboard
operator fun component2(): Position

Destructuring component for northeast.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(index: Int): Double

Get the coordinate at the given index.

Link copied to clipboard
fun getOrNull(index: Int): Double?
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open operator override fun iterator(): Iterator<Double>
Link copied to clipboard
fun toJson(): String

Serialize this bounding box to a JSON string.

Link copied to clipboard
open override fun toString(): String