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:

>>> 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, obtain 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

Rtree version 0.3 depends upon spatialindex version 1.1.1. 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.

The command:

$ python setup.py install

installs an egg. You can build and test in place like so:

$ python setup.py test

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

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.3.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distributions

Rtree-0.3.0-py2.5-macosx-10.5-i386.egg (16.7 kB view details)

Uploaded Source

Rtree-0.3.0-py2.4-linux-i686.egg (53.7 kB view details)

Uploaded Source

File details

Details for the file Rtree-0.3.0.tar.gz.

File metadata

  • Download URL: Rtree-0.3.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Rtree-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ca756470d3c14ffb2f1c6211157ebc7e0caec6470f70a8fdf2cd67f043fba41e
MD5 d407eb64458dd664eb286fe8ecf5962a
BLAKE2b-256 31bb1cb85748ffe4efb6ee9b6800b71430956d4943d010e203985d7702884719

See more details on using hashes here.

File details

Details for the file Rtree-0.3.0-py2.5-macosx-10.5-i386.egg.

File metadata

File hashes

Hashes for Rtree-0.3.0-py2.5-macosx-10.5-i386.egg
Algorithm Hash digest
SHA256 05761177be624606803f8cc95fdbd63428a559911372606197bbfb7831a0796e
MD5 6edcbf4ce12add7165dc6db7f983f9d7
BLAKE2b-256 0fb220569fa04693654c1aa8d51c8687897ab71b5e75a307184b9d4b2aa1702b

See more details on using hashes here.

File details

Details for the file Rtree-0.3.0-py2.4-linux-i686.egg.

File metadata

File hashes

Hashes for Rtree-0.3.0-py2.4-linux-i686.egg
Algorithm Hash digest
SHA256 b4ffc01b570eab8ff7a37293b301b93bfb94098c983e65e09da30457dae7b746
MD5 f97daf31285df14b4bf869e4925dde9c
BLAKE2b-256 a9c1f0722805b0f5f6a6f6793ff84f5d32afd3b49cc921837098b033a5dac224

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page