Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 18 down vote accepted

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.

share|improve this answer
    
Great explanation, +1. –  Derek Swingley Jul 7 '11 at 16:05
1  
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

share|improve this answer
1  
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
1  
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.