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

Uploaded Source

Built Distributions

Rtree-0.4.2.win32-py2.6.exe (322.6 kB view details)

Uploaded Source

Rtree-0.4.2.win32-py2.5.exe (299.0 kB view details)

Uploaded Source

Rtree-0.4.2.win32-py2.4.exe (298.9 kB view details)

Uploaded Source

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

Uploaded Source

Rtree-0.4.2-py2.5-win32.egg (235.0 kB view details)

Uploaded Source

Rtree-0.4.2-py2.4-win32.egg (235.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for Rtree-0.4.2.tar.gz
Algorithm Hash digest
SHA256 955ac04cf795e57468dfcbc1172c91fe6475075d7cb133e1a8a1bfbb9b934049
MD5 348a5785a66be2f96ea189fa97b27e52
BLAKE2b-256 a59618c071b7011d46e8cd2872e15dd2a686cd1b56ed1fa2fd8df2647b350247

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.2.win32-py2.6.exe
Algorithm Hash digest
SHA256 55bbf69d2abd145d4be9e1f140d36953db3dc6ee843c6fd4a9564938161b2000
MD5 63f4a3b25035b2b0e5323b39a79c8c39
BLAKE2b-256 b314f3804ecb841236d13c409958dfe1c430dd1b908bcecc3579647d89a20d4a

See more details on using hashes here.

File details

Details for the file Rtree-0.4.2.win32-py2.5.exe.

File metadata

File hashes

Hashes for Rtree-0.4.2.win32-py2.5.exe
Algorithm Hash digest
SHA256 5ec3401b9e870bbd523757dc9f8611dfb77e99d63006f22111edf8bc2b5e3ce1
MD5 456696577ce4501ff0a9fcee53d0d5e7
BLAKE2b-256 59baec8e073f155f7f26db09844cf8833543e0f6c968609adca893f79986298a

See more details on using hashes here.

File details

Details for the file Rtree-0.4.2.win32-py2.4.exe.

File metadata

File hashes

Hashes for Rtree-0.4.2.win32-py2.4.exe
Algorithm Hash digest
SHA256 400caae4cba0508b295c81c208f5f9fd79504b0292f716bbe466dcc3e047aba0
MD5 71da5ee35386f0354b1bfc8c18ca747c
BLAKE2b-256 9838a3dcc6f3fd7f0500cc559f4736b5f5f03f7dffc2bbf1535580853f8d590d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.2-py2.6-win32.egg
Algorithm Hash digest
SHA256 ee3b4b67e1ce48a2d1fa7cd450b1f4893ae7d49fa02d357c033599773876f363
MD5 215ea335091df23766ee8a8da29002a5
BLAKE2b-256 75e793b23602439844fbb11822ce8758f08055a50402970c0c350cd51e9b0de6

See more details on using hashes here.

File details

Details for the file Rtree-0.4.2-py2.5-win32.egg.

File metadata

File hashes

Hashes for Rtree-0.4.2-py2.5-win32.egg
Algorithm Hash digest
SHA256 c0d85ea631db131415e586534d715c2c6d3b6b90a93a7d9715aeb3ba690c6f62
MD5 e9febd0742ca0d69bf842e987e6078c4
BLAKE2b-256 ac32be3edf912411aed2b2f8959b3c93050faaf1696a24ed437f86d5b2511200

See more details on using hashes here.

File details

Details for the file Rtree-0.4.2-py2.4-win32.egg.

File metadata

File hashes

Hashes for Rtree-0.4.2-py2.4-win32.egg
Algorithm Hash digest
SHA256 b27ebc7ac66ae7c9e9c1f2c52abe5cbaaccc8be6608d4893ffdafa68971d73cb
MD5 6c0269b139877dcc976cb8d8be02bbfe
BLAKE2b-256 0e3a8422ea1ab280feec8d631f13fd4390236ed6b4abcdac7c5a3006e9fe9c1e

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