flattenEach
描述
¥Description
Iterate over flattened features in any GeoJSON object, similar to Array.forEach.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geojson | FeatureCollection | 特性 | GeometryObject | GeometryCollection | 特性<GeometryCollection> | 任意 GeoJSON 对象 |
callback | flattenEachCallback | a method that takes (currentFeature, featureIndex, multiFeatureIndex) |
返回
¥Returns
void
示例
¥Examples
var features = turf.featureCollection([
turf.point([26, 37], { foo: "bar" }),
turf.multiPoint(
[
[40, 30],
[36, 53],
],
{ hello: "world" },
),
]);
turf.flattenEach(
features,
function (currentFeature, featureIndex, multiFeatureIndex) {
//=currentFeature
//=featureIndex
//=multiFeatureIndex
},
);
安装
¥Installation
$ npm install @turf/meta
import { flattenEach } from "@turf/meta";
const result = flattenEach(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.flattenEach(...);