Whether for in-memory feature stores, Plone content, or whatever -- we need an index to speed up the search for objects that intersect with a spatial bounding box.
Index Protocol
In a nutshell:
>>> from rtree import Rtree
>>> index = Rtree()
>>> index.add(id=id, bounds=(left, bottom, right, top))
>>> [n for n in index.intersection((left, bottom, right, top))]
[id]
This resembles a subset of the set protocol. add indexes a new object by id, intersection returns an iterator over ids where the node containing the id intersects with the specified bounding box. The intersection method is exact, with no false positives and no missed data. Ids can be long ints or ints; index queries return long ints.
Product's homepage
Requirements:
· Python