Skip to main content
Version: 7.2.0

convertLength

描述

¥Description

将长度从一个单位转换为另一个单位。

¥Converts a length from one unit to another.

参数

¥Parameters

名称类型描述
lengthnumber待转换的长度
originalUnit?单位输入长度单位(默认 "kilometers")
finalUnit?单位返回长度单位(默认 "kilometers")

返回

¥Returns

number 转换后的长度

¥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(...);