mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
gis: Fixed #5434, GEOS simplify()
may now preserve topologies via patch from rcoup.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6315 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
101446dbda
commit
9c1714234a
@ -496,12 +496,21 @@ class GEOSGeometry(object):
|
|||||||
"Computes an interior point of this Geometry."
|
"Computes an interior point of this Geometry."
|
||||||
return self._unary_topology(lgeos.GEOSPointOnSurface)
|
return self._unary_topology(lgeos.GEOSPointOnSurface)
|
||||||
|
|
||||||
def simplify(self, tolerance=0.0):
|
def simplify(self, tolerance=0.0, preserve_topology=False):
|
||||||
"""
|
"""
|
||||||
Returns the Geometry, simplified using the Douglas-Peucker algorithm
|
Returns the Geometry, simplified using the Douglas-Peucker algorithm
|
||||||
to the specified tolerance (higher tolerance => less points). If no
|
to the specified tolerance (higher tolerance => less points). If no
|
||||||
tolerance provided, defaults to 0.
|
tolerance provided, defaults to 0.
|
||||||
|
|
||||||
|
By default, this function does not preserve topology - e.g. polygons can
|
||||||
|
be split, collapse to lines or disappear holes can be created or
|
||||||
|
disappear, and lines can cross. By specifying preserve_topology=True,
|
||||||
|
the result will have the same dimension and number of components as the
|
||||||
|
input. This is significantly slower.
|
||||||
"""
|
"""
|
||||||
|
if preserve_topology:
|
||||||
|
return self._unary_topology(lgeos.GEOSTopologyPreserveSimplify, c_double(tolerance))
|
||||||
|
else:
|
||||||
return self._unary_topology(lgeos.GEOSSimplify, c_double(tolerance))
|
return self._unary_topology(lgeos.GEOSSimplify, c_double(tolerance))
|
||||||
|
|
||||||
def relate(self, other):
|
def relate(self, other):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user