Skip to main content
Version: 7.1.0

convertLength

Description

Converts a length to the requested unit. Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet

Parameters

NameTypeDescription
lengthnumberto be converted
originalUnit?Unitsof the length (default "kilometers")
finalUnit?Unitsreturned unit (default "kilometers")

Returns

    number the converted length

Installation

$ npm install @turf/helpers

import { convertLength } from "@turf/helpers";
const result = convertLength(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.convertLength(...);