MapboxDistanceUtil

object MapboxDistanceUtil

A utility for rounding distances for displaying in view components.

Functions

Link copied to clipboard
fun formatDistance(    distanceInMeters: Double,     roundingIncrement: Int,     unitType: UnitType): Double
fun formatDistance(    distanceInMeters: Double,     roundingIncrement: Int,     unitType: UnitType,     context: Context): FormattedDistanceData
fun formatDistance(    distanceInMeters: Double,     roundingIncrement: Int,     unitType: UnitType,     context: Context,     locale: Locale): FormattedDistanceData

This will recalculate and format a distance based on the parameters inputted. The value will be rounded for visual display and a distance suffix like 'km' for kilometers or 'ft' for foot/feet will be included.