@watergis/maplibre-gl-terradraw
    Preparing search index...
    • Convert distance according to the distance unit given.

      Converts a distance in kilometers or miles to the appropriate unit based on the unit and forceUnit parameters.

      • For kilometers, it converts to km, m, or cm depending on the value and forceUnit.
      • For miles, it converts to mi, ft, or in depending on the value and forceUnit.
      • For degrees or radians, it returns the value unchanged with the corresponding unit symbol.

      Parameters

      • value: number

        The distance in the unit specified by the unit parameter.

      • unit: MeasureUnitType = 'metric'

        The unit of the input distance type: "metric", or "imperial" (default is 'metric').

      • forceUnit: forceDistanceUnitType = 'auto'

        Default is auto. If auto is set, the unit is converted automatically based on the value. If a specific unit is set, the value is converted to that unit.

      • measureUnitSymbols: MeasureUnitSymbolType = defaultMeasureUnitSymbols

        Optional parameter to provide custom unit symbols

      Returns { distance: number; unit: string }

      The converted value and unit.