# cleanCoords
Removes redundant coordinates from any GeoJSON Geometry.
从任何GeoJSON几何图形中移除冗余坐标。
> npm install @turf/clean-coords
参数
参数 | 类型 | 描述 |
---|---|---|
geojson | (Geometry|Feature) | Feature or Geometry |
options | Object | Optional parameters: see below |
options选项
属性 | 类型 | 默认值 | 描述 |
---|---|---|---|
mutate | boolean | false | allows GeoJSON input to be mutated |
返回
(Geometry|Feature) - the cleaned input Feature/Geometry
示例
var line = turf.lineString([[0, 0], [0, 2], [0, 5], [0, 8], [0, 8], [0, 10]]);
var multiPoint = turf.multiPoint([[0, 0], [0, 0], [2, 2]]);
turf.cleanCoords(line).geometry.coordinates;
//= [[0, 0], [0, 10]]
turf.cleanCoords(multiPoint).geometry.coordinates;
//= [[0, 0], [2, 2]]