[polygons] Separating out simplify polygon into a method in RTree index

This commit is contained in:
Al
2015-08-13 18:43:32 -04:00
parent 46f2c68a69
commit 9125f07af0
2 changed files with 8 additions and 4 deletions

View File

@@ -46,11 +46,12 @@ class RTreePolygonIndex(object):
def index_polygon(self, id, polygon):
self.index.insert(id, polygon.bounds)
def add_polygon(self, poly, properties, simplify_tolerance=0.0001, preserve_topology=True):
poly = poly.simplify(simplify_tolerance, preserve_topology=preserve_topology)
def simplify_polygon(self, poly, simplify_tolerance=0.0001, preserve_topology=True):
return poly.simplify(simplify_tolerance, preserve_topology=preserve_topology)
def add_polygon(self, poly, properties):
if self.include_only_properties:
properties = {k: v for k, v in properties.iteritems() if k in self.include_only_properties}
self.polygons.append((properties, prep(poly)))
@classmethod