Position

@Serializable(with = PositionSerializer::class)
class Position(val coordinates: DoubleArray)

A position is the fundamental geometry construct. Positions are represented by Positions in Spatial K

In JSON, a position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order using decimal numbers. Altitude or elevation MAY be included as an optional third element.

When serialized, the latitude, longitude, and altitude (if present) will be represented as an array.

LngLat(longitude = -75.0, latitude = 45.0)

will be serialized as

[-75.0,45.0]

See also

Constructors

Link copied to clipboard
constructor(longitude: Double, latitude: Double)
constructor(longitude: Double, latitude: Double, altitude: Double)
constructor(longitude: Double, latitude: Double, altitude: Double?)
constructor(coordinates: DoubleArray)

Properties

Link copied to clipboard

Optionally, an altitude or elevation for this position

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The latitude value of this position (or northing value for projected coordinates)

Link copied to clipboard

The longitude value of this position (or easting value for projected coordinates)

Functions

Link copied to clipboard
operator fun component1(): Double

Component function for getting the longitude

Link copied to clipboard
operator fun component2(): Double

Component function for getting the latitude

Link copied to clipboard
operator fun component3(): Double?

Component function for getting the altitude

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun json(): String
Link copied to clipboard
open override fun toString(): String