I have a few multipolygons that have several hundred points in them. I'm looking to create less complex "thumbnails" polygons.

Naturally I'm attempting to use the simplify method, which is supposed to apply the Ramer-Douglas-Peucker algorithm. However, it doesn't seem to be working:

>>> m = Multipolygon.objects.get(id=1)
>>> m.geometry.num_points
>>> m.geometry.simplify(0).num_points
>>> m.geometry.simplify(1).num_points
>>> m.geometry.simplify(0.5).num_points
>>> m.geometry.simplify(10).num_points

I'm clearly missing something. When I simplify, I either get the original polygon back or an empty one, depending on the tolerance value that I use. How is the tolerance parameter supposed to work?

1 Answer 1


The tolerance value is specified in map units: if two points are within the snapping tolerance, they are collapsed. So if you have geographic coordinates, simplify(1) would collapse everything to the nearest degree. Try something like simplify(0.0001) to start, or smaller depending on the resolution of your input data.

You may also be interested in this snippet, which allows you to specify precision as a number of points to retain in the output geometry.

  • Thanks! All of my values are in lat/lng (wgs84), and nearby points are probably within 100m, so a tolerance of 1 degree is way too much! The snippet is great too, that was going to be my followup question.
    – Seth
    Aug 17, 2010 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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