skip to navigation
skip to content

Not Logged In

Rtree 0.4.3

R-Tree spatial index for Python GIS

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.

See also CHANGES.txt.

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 ints or long ints; index queries return long ints.

Installation

First, download and install version 1.3 of the spatialindex library from:

http://trac.gispython.org/projects/SpatialIndex/wiki/Releases

The library is a GNU-style build, so it is just a matter of:

$ ./configure; make; make install

At this point you can get Rtree 0.4 via easy_install:

$ easy_install Rtree

or by running the local setup.py:

$ python setup.py install

You can build and test in place like:

$ python setup.py test

Previous Versions

Users of Rtree versions <= 0.3 should use spatialindex 1.1.1. Download and install a copy of both spatialindex and tools libraries from:

http://research.att.com/~marioh/tools/index.html

http://research.att.com/~marioh/spatialindex/index.html

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

$ CPPFLAGS=-DNDEBUG ./configure; make; make install

for each. Debugging is on by default in 1.1.1, you'll want to turn it off for use in production. The spatialindex library depends on the tools library, so make sure to build and install that first.

Usage

See tests/R-Tree.txt.

Performance

See the tests/benchmarks.py file for a comparison.

Support

For current information about this project, see the wiki.

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

http://trac.gispython.org/projects/PCL/wiki/CommunityList

File Type Py Version Uploaded on Size # downloads
Rtree-0.4.3-py2.5-win32.egg (md5) Python Egg 2.5 2009-06-05 18:14:56.091367 229KB 36
Rtree-0.4.3.win32-py2.6.exe (md5) MS Windows installer 2.6 2009-06-05 18:16:13.693333 315KB 10
Rtree-0.4.3-py2.6-win32.egg (md5) Python Egg 2.6 2009-06-05 18:16:03.105293 248KB 31
Rtree-0.4.3.win32-py2.5.exe (md5) MS Windows installer 2.5 2009-06-05 18:15:06.595969 291KB 9
Rtree-0.4.3-py2.4-win32.egg (md5)
built on Windows-XP
Python Egg 2.4 2009-06-05 18:14:21.278336 229KB 31
Rtree-0.4.3.win32-py2.4.exe (md5) MS Windows installer 2.4 2009-06-05 18:14:32.651121 291KB 4
Rtree-0.4.3.tar.gz (md5) Source 2009-06-05 18:13:02.094184 30KB 203