turf.simplify
What is turf.simplify?
turf.simplify reduces the number of vertices in a GeoJSON LineString, Polygon, or multi-variant using the Ramer-Douglas-Peucker algorithm (or, optionally, the high-quality radial-distance variant). The tolerance parameter controls how aggressive the simplification is.
turf.simplify(geojson, options?) → Feature<Geometry>Options include:
tolerance— simplification tolerance (default1, in degrees of longitude/latitude)highQuality—boolean(defaultfalse); slower but produces better resultsmutate—boolean(defaultfalse); whentrue, mutates the input in place
When would you use turf.simplify?
Use turf.simplify to cut vertex count before rendering or transmitting GeoJSON — useful for shipping smaller tilesets, speeding up map rendering of dense polygons, or reducing the cost of subsequent topology operations. Pair with turf.cleanCoords for best results.
In Node.js ETL, simplification is the standard preprocessing step for public-facing GeoJSON. A common pattern: simplify at multiple tolerances to build zoom-dependent versions of a layer.
undefinedFAQs
What units is tolerance in?
Degrees. This is one of the few Turf functions that works in raw coordinate units. Adjust tolerance based on the latitude and the scale of your data — at the equator 0.001° ≈ 111 m; scale accordingly for your context.
When should I use highQuality?
Whenever output is user-facing. highQuality: true preserves topology better and avoids artefacts from very aggressive simplification. It is slightly slower but the difference is rarely significant for UI workflows.
How do I install just simplify?
npm install @turf/simplify. It depends on @turf/helpers, @turf/clean-coords, and @turf/meta.
Can it break topology on a FeatureCollection?
Yes — turf.simplify operates feature by feature with no awareness of shared edges. For topology-preserving simplification across adjacent polygons, use mapshaper or topojson tooling.