Skip to content

KBE3D / KBCore / turf / flattenEach

函数: flattenEach()

flattenEach<G, P>(geojson: GeometryCollection<Geometry> | G | Feature<G, P> | FeatureCollection<G, P> | Feature<GeometryCollection<Geometry>, P>, callback: (currentFeature: Feature<G, P>, featureIndex: number, multiFeatureIndex: number) => void): void

Function

Iterate over flattened features in any GeoJSON object, similar to Array.forEach.

类型参数

G

G extends Geometry = Geometry

P

P extends GeoJsonProperties = GeoJsonProperties

参数

geojson

any GeoJSON object

GeometryCollection<Geometry> | G | Feature<G, P> | FeatureCollection<G, P> | Feature<GeometryCollection<Geometry>, P>

callback

(currentFeature: Feature<G, P>, featureIndex: number, multiFeatureIndex: number) => void

a method that takes (currentFeature, featureIndex, multiFeatureIndex)

返回

void

示例

ts
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
});

KBE3D @3.0.0 Copyright © 2024-present KBE3D