turf-simplify
simplify
Takes a LineString or Polygon and returns a simplified version. Internally uses simplify-js to perform simplification.
Parameters
feature
(Feature<(LineString | Polygon | MultiLineString | MultiPolygon)> | FeatureCollection | GeometryCollection) feature to be simplifiedtolerance
number simplification tolerancehighQuality
boolean whether or not to spend more time to create a higher-quality simplification with a different algorithm
Examples
var feature = "type": "Feature" "properties": {} "geometry": "type": "Polygon" "coordinates": -70603637 -33399918 -70614624 -33395332 -70639343 -33392466 -70659942 -33394759 -70683975 -33404504 -70697021 -33419406 -70701141 -33434306 -70700454 -33446339 -70694274 -33458369 -70682601 -33465816 -70668869 -33472117 -70646209 -33473835 -70624923 -33472117 -70609817 -33468107 -70595397 -33458369 -70587158 -33442901 -70587158 -33426283 -70590591 -33414248 -70594711 -33406224 -70603637 -33399918 ; var tolerance = 001; var simplified = turf; //=feature //=simplified
Returns (Feature<(LineString | Polygon | MultiLineString | MultiPolygon)> | FeatureCollection | GeometryCollection) a simplified feature
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.
Installation
Install this module individually:
$ npm install turf-simplify
Or install the Turf module that includes it as a function:
$ npm install turf