Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
enum Units : Enum<Units>

Supported units of measurement in Turf.

Properties

Link copied to clipboard
const val AREA_EARTH_RADIUS: Int = 6378137
Link copied to clipboard
const val EARTH_RADIUS: Double = 6371008.8

Radius of the Earth used with the Harvesine formula. Approximated using a spherical (non-ellipsoid) Earth.

Functions

Link copied to clipboard

Converts any bearing angle from the north line direction (positive clockwise) and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line

Link copied to clipboard
fun convertArea(area: Double, from: Units = Units.Meters, to: Units = Units.Kilometers): Double

Converts an area to the requested unit. Valid units: Acres, Miles, Inches, Yards, Meters, Kilometers, Centimeters, Feet

Link copied to clipboard
fun convertLength(length: Double, from: Units = Units.Meters, to: Units = Units.Kilometers): Double

Converts a length to the requested unit

Link copied to clipboard
fun lengthToDegrees(distance: Double, units: Units = Units.Kilometers): Double

Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees.

Link copied to clipboard
fun lengthToRadians(distance: Double, units: Units = Units.Kilometers): Double

Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians.

Link copied to clipboard
fun radiansToLength(radians: Double, units: Units = Units.Kilometers): Double

Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.