distance

fun distance(lat1: Double, long1: Double, lat2: Double, long2: Double): Double

Compute the Haversine distance between the two coordinates.

Return

The distance in meters.

Parameters

lat1

The start latitude in decimal degrees.

long1

The start longitude in decimal degrees.

lat2

The finish latitude in decimal degrees.

long2

the finish longitude in decimal degrees.


fun distance(l1: LngLatAlt, l2: LngLatAlt, p: LngLatAlt, nearestPoint: LngLatAlt? = null): Double

Calculate distance of a point p to a line defined by two other points l1 and l2.

Return

the distance of the point to the line

Parameters

l1

point 1 on the line

l2

point 2 on the line

p

current location point


fun distance(x1: Double, y1: Double, x2: Double, y2: Double, x: Double, y: Double, nearestPoint: LngLatAlt? = null): Double

Calculate distance of a point (pLat,pLon) to a line defined by two other points (lat1,lon1) and (lat2,lon2)

Return

the distance of the point to the line

Parameters

x1

double

y1

double

x2

double

y2

double

x

double

y

double