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

Uploaded Source

Built Distributions

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

Uploaded Source

Rtree-0.4.3.win32-py2.5.exe (298.9 kB view details)

Uploaded Source

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

Uploaded Source

Rtree-0.4.3-py2.6-win32.egg (254.1 kB view details)

Uploaded Source

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

Uploaded Source

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for Rtree-0.4.3.tar.gz
Algorithm Hash digest
SHA256 fdd5a25a52560eae3864c75c6b770ba7a883c598d2228999523e60b99e8168b8
MD5 b28bc97a9af00259e062aae4040091b6
BLAKE2b-256 f1f860b6b883f63d23eae37242e24a564b592c575d8e5c1ed126ef99fb779c38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.3.win32-py2.6.exe
Algorithm Hash digest
SHA256 17c2107f144b2b5563054704e21d5319309967088f226c1ba25fca4165451efd
MD5 606f66c89b09515a23a62753dbff50c2
BLAKE2b-256 9089f72a6ffa855a771b331e748128109ec880175febb4ccbc6d83a2a85b42fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.3.win32-py2.5.exe
Algorithm Hash digest
SHA256 82e4cc054d0d2b32cc65c7e9b05279eff4a2c224b81d44cf795d4e9712a47ab7
MD5 d39a14d1dd0ef3652a0dc0a1b2efa510
BLAKE2b-256 8d9d97a4964e4aeea3885c5c1751c77aee9772e44cfaeecbebb467b6740537b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.3.win32-py2.4.exe
Algorithm Hash digest
SHA256 5e5f5896803e704318b0481368e4041a87403fc7ddaf34ea0d3a2365e2ea2e1e
MD5 b0214e2c3d3a3a10c26b9b63244145f3
BLAKE2b-256 7b67448eb0d303ef94803cc07412cb7899944f8bbcea91dca5c1c0abcc7cde02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.3-py2.6-win32.egg
Algorithm Hash digest
SHA256 d1727ca279cd405c5c09086ebafa0a8c7ab4dd0764367e59a2aae9491b394acc
MD5 b4cdc2f1db54587db665df1053dfc2f1
BLAKE2b-256 2941aa352d678615955fcf6d448d90b485441c61c3f7e0acc3a967bb4d95c6b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.3-py2.5-win32.egg
Algorithm Hash digest
SHA256 89aee68be5a24066583556ada619a66aa6266dc64472153446a399df3fc26e9b
MD5 b3c3bb444bd98ce3ceba11d44c35bbe5
BLAKE2b-256 cf2411a66496d7cda416bb0b21423b5480bbf92c42bc850624ac3f27b8f04cd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Rtree-0.4.3-py2.4-win32.egg
Algorithm Hash digest
SHA256 c8c6952a9d3c135d4f4fafac046aa7402934e35b02d3a8ed47ba0e7d778e4905
MD5 994b139ec2fce54f824655c4ba23785f
BLAKE2b-256 d0179a9941fad8d75773803302b2eaa5de94a02d83ad07478c42e42f5edc6b29

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