Ticket #5434: simplify_preserve_topology.patch
File simplify_preserve_topology.patch, 1.5 KB (added by , 17 years ago) |
---|
-
django/contrib/gis/geos/base.py
480 480 "Computes an interior point of this Geometry." 481 481 return self._unary_topology(lgeos.GEOSPointOnSurface) 482 482 483 def simplify(self, tolerance=0.0 ):483 def simplify(self, tolerance=0.0, preserve_topology=False): 484 484 """ 485 485 Returns the Geometry, simplified using the Douglas-Peucker algorithm 486 486 to the specified tolerance (higher tolerance => less points). If no 487 487 tolerance provided, defaults to 0. 488 489 By default, this function does not preserve topology - e.g. polygons can 490 be split, collapse to lines or disappear holes can be created or 491 disappear, and lines can cross. By specifying preserve_topology=True, 492 the result will have the same dimension and number of components as the 493 input. This is significantly slower. 488 494 """ 489 return self._unary_topology(lgeos.GEOSSimplify, c_double(tolerance)) 495 if preserve_topology: 496 return self._unary_topology(lgeos.GEOSTopologyPreserveSimplify, c_double(tolerance)) 497 else: 498 return self._unary_topology(lgeos.GEOSSimplify, c_double(tolerance)) 490 499 491 500 def relate(self, other): 492 501 "Returns the DE-9IM intersection matrix for this Geometry and the other."