# coordReduce

Reduce coordinates in any GeoJSON object, similar to Array.reduce()

> npm install @turf/meta


参数 类型 描述
geojson (FeatureCollection|Geometry|Feature) 任何 GeoJSON 对象
callback Function a method that takes (previousValue, currentCoord, coordIndex)
initialValue (*) Value to use as the first argument to the first call of the callback.
excludeWrapCoord boolean whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.


    • The value that results from the reduction.


var features = turf.featureCollection([
  turf.point([26, 37], {"foo": "bar"}),
  turf.point([36, 53], {"hello": "world"})

turf.coordReduce(features, function (previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
  return currentCoord;
Last Updated: 6/21/2023, 11:40:17 PM