Skip to main content

R-Tree spatial index for Python GIS

Project description

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:

>>> index.add(id=id, bounds=(left, bottom, right, top))
>>> [n for n in index.intersection((left, bottom, right, top))]

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.


Obtain and install a copy of both spatialindex and tools libraries from:

Each library is a GNU-style build, so it should just be a matter of:

$ ./configure; make; make install

for each. The spatialindex library depends on the tools library, so make sure to build and install that first.

The command:

$ python install

installs an egg. If you’d rather stick with the old-school distributions, use:

$ python install --root / --single-version-externally-managed


See tests/R-Tree.txt.


See the tests/ file for a comparison.


For current information about this project, see the wiki.

If you have questions, please consider joining our community list:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Rtree-0.2.0.tar.gz (26.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page