Django

Code

Changeset 6315

Show
Ignore:
Timestamp:
09/15/07 14:19:11 (10 months ago)
Author:
jbronn
Message:

gis: Fixed #5434, GEOS simplify() may now preserve topologies via patch from rcoup.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/geos/base.py

    r6314 r6315  
    497497        return self._unary_topology(lgeos.GEOSPointOnSurface) 
    498498 
    499     def simplify(self, tolerance=0.0): 
     499    def simplify(self, tolerance=0.0, preserve_topology=False): 
    500500        """ 
    501501        Returns the Geometry, simplified using the Douglas-Peucker algorithm 
    502502         to the specified tolerance (higher tolerance => less points).  If no 
    503503         tolerance provided, defaults to 0. 
    504         """ 
    505         return self._unary_topology(lgeos.GEOSSimplify, c_double(tolerance)) 
     504 
     505        By default, this function does not preserve topology - e.g. polygons can  
     506         be split, collapse to lines or disappear holes can be created or  
     507         disappear, and lines can cross. By specifying preserve_topology=True,  
     508         the result will have the same dimension and number of components as the  
     509         input. This is significantly slower.          
     510        """ 
     511        if preserve_topology: 
     512            return self._unary_topology(lgeos.GEOSTopologyPreserveSimplify, c_double(tolerance)) 
     513        else: 
     514            return self._unary_topology(lgeos.GEOSSimplify, c_double(tolerance))         
    506515 
    507516    def relate(self, other):