Skip to content

KBE3D / KBCore / turf / lineEach

函数: lineEach()

lineEach<P>(geojson: GeometryCollection<Geometry> | Lines | FeatureCollection<Lines, P> | Feature<Lines, P> | Feature<GeometryCollection<Geometry>, P>, callback: (currentLine: Feature<LineString, P>, featureIndex?: number, multiFeatureIndex?: number, geometryIndex?: number) => void): void

Function

Iterate over line or ring coordinates in LineString, Polygon, MultiLineString, MultiPolygon Features or Geometries, similar to Array.forEach.

类型参数

P

P extends GeoJsonProperties = GeoJsonProperties

参数

geojson

object

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

callback

(currentLine: Feature<LineString, P>, featureIndex?: number, multiFeatureIndex?: number, geometryIndex?: number) => void

a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex)

返回

void

示例

ts
var multiLine = turf.multiLineString([
  [[26, 37], [35, 45]],
  [[36, 53], [38, 50], [41, 55]]
]);

turf.lineEach(multiLine, function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {
  //=currentLine
  //=featureIndex
  //=multiFeatureIndex
  //=geometryIndex
});

KBE3D @3.0.0 Copyright © 2024-present KBE3D