# Meaning of Simplify's tolerance parameter

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?

-

## 3 Answers

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.

-
Great explanation, +1. – Derek Swingley Jul 7 '11 at 16:05
Usually, this tolerance parameter value should be equal to the target resolution. – julien Feb 7 '13 at 17:37
@julien That makes sense. I always like to understand the reasoning behind such rules of thumb, because in my experience many such conclusions don't hold up when more closely examined. (And it's delightful to be surprised like that: you always learn something.) Could you therefore share your thoughts about why the tolerance ought to equal the "target resolution" (and what exactly that resolution is)? – whuber Feb 7 '13 at 17:41

Didn't see it in the link you posted but found this:

The units of tolerance are the same as the projection of the input geometry.

http://revenant.ca/www/postgis/workshop/advanced.html#processing-functions

-
I see. But what does it exactly means when say the geometry is WGS84 (lat/lon) and set the tolerance to 1.0? Error within 1 degree? Still a bit confused. – ejel Jul 6 '11 at 22:59
I wouldn't say "error within 1 degree" ... take a look at the wikipedia page for the algorithm, there's a nice graphic and good explanation there: en.wikipedia.org/wiki/… – Derek Swingley Jul 6 '11 at 23:26

The units are in the units of the input file, it is not arbitrary.

-