Package-level declarations

Measurement functions for calculating distances, areas, bearings, centers, bounding boxes, and other geospatial metrics using the Haversine formula and related algorithms.

Functions

Link copied to clipboard
@JvmName(name = "areaAsArea")
fun Geometry.area(): Area

Takes a geometry and returns its area.

Link copied to clipboard
@JvmName(name = "bearingToAsBearing")
fun Point.bearingTo(to: Point, final: Boolean = false): Bearing

Takes two points and finds the geographic bearing between them, i.e., the angle measured in degrees from the north line.

@JvmName(name = "bearingToAsBearing")
fun Position.bearingTo(to: Position, final: Boolean = false): Bearing

Takes two positions and finds the geographic bearing between them, i.e., the angle measured in degrees from the north line.

Link copied to clipboard
Link copied to clipboard
fun computeBbox(coordinates: List<Position>): BoundingBox

Computes the bounding box that encompasses all given coordinates.

Link copied to clipboard

Takes a Geometry and calculates the bounding box of all input features.

Link copied to clipboard
@JvmName(name = "distanceAsLength")
fun distance(from: LineString, to: Point): Length

Calculates the distance between a given line and the nearest point on the line to a point.

@JvmName(name = "distanceAsLength")
fun distance(from: LineString, to: Position): Length

Calculates the distance between a given line and the nearest point on the line to a position.

@JvmName(name = "distanceAsLength")
fun distance(from: Point, to: LineString): Length
@JvmName(name = "distanceAsLength")
fun distance(from: Position, to: LineString): Length

Calculates the distance between a given point and the nearest point on a line.

@JvmName(name = "distanceAsLength")
fun distance(from: Point, to: Point): Length

Calculates the distance between two points. This uses the Haversine formula to account for global curvature.

@JvmName(name = "distanceAsLength")
fun distance(from: Position, to: Position): Length

Calculates the distance between two positions. This uses the Haversine formula to account for global curvature.

Link copied to clipboard

Takes a Geometry and returns a rectangular Polygon that encompasses all vertices.

Link copied to clipboard
fun greatCircle(from: Point, to: Point, pointCount: Int = 100, antimeridianOffset: Double = 10.0): Geometry
fun greatCircle(from: Position, to: Position, pointCount: Int = 100, antimeridianOffset: Double = 10.0): Geometry

Calculate great circles routes as LineString. Raises error when from and to are antipodes.

Link copied to clipboard
@JvmName(name = "lengthAsLength")
fun Geometry.length(): Length

Calculates the length of the given Geometry.

Link copied to clipboard

Takes a LineString and returns a Point at a specified distance along the line.

Link copied to clipboard
fun midpoint(pos1: Point, pos2: Point): Position

Takes two Points and returns a point midway between them. The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.

fun midpoint(pos1: Position, pos2: Position): Position

Takes two Positions and returns a point midway between them. The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.

Link copied to clipboard
fun Point.offset(distance: Length, bearing: Bearing): Position

Takes a Point and calculates the location of a destination position given a distance Length and bearing in degrees. This uses the Haversine formula to account for global curvature.

fun Position.offset(distance: Length, bearing: Bearing): Position

Takes a Position and calculates the location of a destination position given a distance Length and bearing in degrees. This uses the Haversine formula to account for global curvature.

Link copied to clipboard
@JvmName(name = "rhumbDistanceAsLength")
fun rhumbDistance(from: Point, to: Point): Length
@JvmName(name = "rhumbDistanceAsLength")
fun rhumbDistance(from: Position, to: Position): Length

Calculates the distance along a rhumb line between two points.

Link copied to clipboard

Takes a bounding box and calculates the minimum square bounding box that would contain the input.

Link copied to clipboard

Takes a bounding box and returns an equivalent Polygon.

Link copied to clipboard
inline fun <T : GeoJsonObject> T.withComputedBbox(): T

Returns a copy of this GeoJSON object with a computed bounding box.