DistanceCalculator

interface DistanceCalculator

Distance calculator for WGS84 (Earth as spheroid). Should be initialized by latitude and used in some not far around area.

Fast and precise for nearby points (distance <= 200 km). Expected error is 0.04%.

In other cases (distance 200 km), uses DistanceCalculator.distanceOnSphere function.

To obtain DistanceCalculator instance, please, use MapboxSearchSdk.serviceProvider.

Return

Distance in meters.

Functions

distance
Link copied to clipboard
abstract fun distance(from: Point, to: Point): Double
Calculates distance between two coordinates.