PostGIS Algorithm – Understanding Simplify’s Tolerance Parameter

algorithmpostgissimplify

The standard parameters of Douglas-Peucker's simplify algorithm are geometry and tolerance (e.g ST_Simplify in PostGIS). What's the meaning of the tolerance parameter? I know that the bigger the value, the coarser the geometry will be. But does the number has any unit or it is just arbitrary?

Best Answer

The tolerance is a distance. Roughly, any "wiggles" in a curve that vary from a straight line by less than this amount will be straightened out. The algorithm finds the most extreme wiggles that exceed the tolerance, pins down the points where they deviate the most from a straight path, and then recursively applies itself to the arcs between the pinned-down wiggles.

The tolerance must be expressed in the same units used by the software to execute the algorithm. (This will depend on whether it uses the coordinates as stored or as projected "on the fly" for display or analysis.) An illustrated description appears in the Wikipedia article on the Douglas-Peucker algorithm.

Related Question