Atlaslog
Atlaslog / Turf.js / Tutorial / Simplify, smooth and dissolve
Turf.js · Tutorial

Simplify, smooth and dissolve

Quick answer

This tutorial covers appearance-changing operations: turf.simplify with a tolerance in coordinate units and highQuality control, bezierSpline smoothing via resolution and sharpness, dissolve merging adjacent polygons that share a property, and convex versus concave hulls with maxEdge. It notes that these edits are irreversible and affect area and perimeter. You will be able to shrink payloads and produce smoother outlines.

Last verified 2026-11-03 · Turf.js 7.x · Cite this page
Key points
Example
var track = turf.lineString([/* 几千个顶点 */]);

console.log('原始顶点', track.geometry.coordinates.length);

var coarse = turf.simplify(track, {
  tolerance: 0.001,        // 约 100 米
  highQuality: true        // 更接近原始形状,代价是更慢
});

console.log('简化后', coarse.geometry.coordinates.length);

var rough = turf.simplify(track, { tolerance: 0.01 });
console.log('更粗', rough.geometry.coordinates.length);
var smooth = turf.bezierSpline(track, {
  resolution: 20000,       // 采样间隔,值越小点越密
  sharpness: 0.85          // 0 到 1,越大越贴近原折线
});

console.log(turf.length(smooth, { units: 'kilometers' }).toFixed(3));
Notes
Runnable examplesChinese originalAll Tutorials
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Simplify, smooth and dissolve. https://www.jingweizhi.com/en/turf/tutorials/simplify-smooth.html (accessed 2026-11-03).