Appearance
KBE3D / KBCore / turf / length
函数: length()
length(
geojson:GeometryCollection<Geometry> |Feature<any,GeoJsonProperties> |FeatureCollection<any,GeoJsonProperties>,options?: {units?:Units; }):number
Function
Takes a GeoJSON and measures its length in the specified units, (Multi)Point's distance are ignored.
参数
geojson
GeoJSON to measure
GeometryCollection<Geometry> | Feature<any, GeoJsonProperties> | FeatureCollection<any, GeoJsonProperties>
options?
Optional parameters
units?
Supports all valid Turf Units.
返回
number
length of GeoJSON
示例
ts
var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
var length = turf.length(line, {units: 'miles'});
//addToMap
var addToMap = [line];
line.properties.distance = length;