Appearance
KBE3D / KBCore / turf / featureEach
函数: featureEach()
featureEach<
G,P>(geojson:Feature<G,P> |FeatureCollection<G,P> |Feature<GeometryCollection<Geometry>,P>,callback: (currentFeature:Feature<G,P>,featureIndex:number) =>void):void
Function
Iterate over features in any GeoJSON object, similar to Array.forEach.
类型参数
G
G extends Geometry
P
P extends GeoJsonProperties = GeoJsonProperties
参数
geojson
any GeoJSON object
Feature<G, P> | FeatureCollection<G, P> | Feature<GeometryCollection<Geometry>, P>
callback
(currentFeature: Feature<G, P>, featureIndex: number) => void
a method that takes (currentFeature, featureIndex)
返回
void
示例
ts
var features = turf.featureCollection([
turf.point([26, 37], {foo: 'bar'}),
turf.point([36, 53], {hello: 'world'})
]);
turf.featureEach(features, function (currentFeature, featureIndex) {
//=currentFeature
//=featureIndex
});