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.

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

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

Uploaded Source

Built Distributions

Rtree-0.4.1.win32-py2.6.exe (322.5 kB view details)

Uploaded Source

Rtree-0.4.1-py2.6-win32.egg (254.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for Rtree-0.4.1.tar.gz
Algorithm Hash digest
SHA256 79cd048d4b740b4245920b5da12b02d8b31193e9e42569340d581775aa36ed81
MD5 2f8a532077c384d6c39d9f60e356f2d2
BLAKE2b-256 af124c24e2daf5ad0b96f71a119f317f289bc0af6e32aed9ac16532b90a6bf1a

See more details on using hashes here.

File details

Details for the file Rtree-0.4.1.win32-py2.6.exe.

File metadata

File hashes

Hashes for Rtree-0.4.1.win32-py2.6.exe
Algorithm Hash digest
SHA256 57a12e08c8827e8466fdf6b1cab0424a4d3ea0eb3b8b2bc178bae471eaa48d78
MD5 17de66d45fac31212b5174dfc658925a
BLAKE2b-256 d87a5b01f6ca82684a749582649132edaf343b5544cb0cbdcad5b6285dd4f891

See more details on using hashes here.

File details

Details for the file Rtree-0.4.1-py2.6-win32.egg.

File metadata

File hashes

Hashes for Rtree-0.4.1-py2.6-win32.egg
Algorithm Hash digest
SHA256 d69c4ae84ac456c9d58122ecbd9bf994fbb12fba23aefc2998b7309a20d8bd0f
MD5 e665a23949f4f9f68f0a9d8ca56acf85
BLAKE2b-256 d226c60974f6ea72790f4bd9788c2d9924b0c3ac2351df2361800448ff638961

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