Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _PrepareRtree(shape_list):
p = rindex.Property()
p.leaf_capacity = 1000
p.variant = rindex.RT_Star
p.fill_factor = 0.02
def Points():
for shape_id in range(1, len(shape_list)):
shape = shape_list[shape_id]
for box in shape.BoxesForRtree(shape_id):
yield box
rtree = rindex.Index(Points(), properties=p)
return rtree
def r_tree(self):
if not hasattr(self, '_r_tree'):
# define properties
p = r_treeIndex.Property()
p.dimension = self.dim()
p.variant = r_treeIndex.RT_Star
index = np.concatenate((range(self.dim()), range(self.dim())))
# Generator provides required point format
def gen():
for id, coord in self:
yield (id, coord[index], id)
self._r_tree = Rtree(gen(), properties=p)
return self._r_tree
def prepare_rtree(dot_list):
p = rindex.Property()
p.leaf_capacity = 1000
p.variant = rindex.RT_Star
p.fill_factor = 0.02
def points():
for index in range(len(dot_list)):
dot = dot_list[index]
yield (index, dot_to_box(dot), None)
rtree = rindex.Index(points(), properties=p)
return rtree