# convertLength

Converts a length to the requested unit. Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
将长度转换为所请求的单位。有效单位:miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet。

> npm install @turf/helpers

参数

参数 类型 描述
length number 待转换的长度
originalUnit string 原单位
finalUnit string 目标单位

返回

number - the converted length

turf.convertLength(1000, 'meters', 'kilometers'); // 1
Last Updated: 4/10/2024, 11:27:54 PM