Skip to content

KBE3D / KBCore / turf / cleanCoords

函数: cleanCoords()

cleanCoords(geojson: any, options?: { mutate?: boolean; }): any

Function

Removes redundant coordinates from any GeoJSON Geometry.

参数

geojson

any

Feature or Geometry

options?

Optional parameters

mutate?

boolean

allows GeoJSON input to be mutated

返回

any

the cleaned input Feature/Geometry

示例

ts
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]]

KBE3D @3.0.0 Copyright © 2024-present KBE3D