distance

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

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

Return

distance between the two points

Parameters

from

origin point

to

destination point


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

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

Return

distance between the two points

Parameters

from

origin point

to

destination point


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

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

Parameters

from

point to calculate from

to

line to calculate to


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

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

This is a convenience function equivalent to calling distance(to, from).

Return

distance between the line and the point

Parameters

from

line to calculate from

to

point to calculate to


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

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

This is a convenience function equivalent to calling distance(to, from).

Return

distance between the line and the point

Parameters

from

line to calculate from

to

point to calculate to