|
|
4 ay önce | |
|---|---|---|
| .. | ||
| dist | 4 ay önce | |
| LICENSE | 4 ay önce | |
| README.md | 4 ay önce | |
| package.json | 4 ay önce | |
Removes redundant coordinates from any GeoJSON Geometry.
geojson (Geometry | Feature) Feature or Geometryoptions Object Optional parameters (optional, default {})
options.mutate boolean allows GeoJSON input to be mutated (optional, default false)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]]
Returns (Geometry | Feature) the cleaned input Feature/Geometry
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/clean-coords
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf