rtree
R-Tree spatial index for Python GIS
Decision gist · record as of 2026-08-14
Yes. Rtree is a mature, actively maintained package with no known vulnerabilities, permissive MIT licensing, and broad platform support. Install friction is medium due to compiled dependencies. Choose it if you need spatial indexing for GIS, scientific computing, or spatial databases.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires libspatialindex system library; on some systems you may need to install it separately before pip install succeeds.
- Medium install friction due to compiled C dependencies.
- Pre-built distributions are available for most major platforms.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2025-08-13 (366 days) · last repo commit 2026-08-10 · 680 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 9,823,017 downloads/mo, #1,497 on PyPI
Alternatives
Verify before relying
pip install rtree
from rtree import index
# Create a spatial index
idx = index.Index()
idx.insert(1, (0.0, 0.0, 1.0, 1.0))
# Query for intersecting geometries
list(idx.intersection((0.5, 0.5, 1.5, 1.5)))- Whether libspatialindex in distributed packages is current and patched for known vulnerabilities.
- Performance characteristics (index build time, query latency) for typical dataset sizes in GIS or scientific applications.
- Whether bundled libspatialindex is included in all distribution channels or requires separate installation on some platforms.
What it is and what it does
Rtree is a Python wrapper around libspatialindex that brings spatial indexing capabilities to Python applications. It allows you to build and query multi-dimensional spatial structures—such as geographic boundaries, bounding boxes, or point clouds—using R-Tree data structures. The package supports nearest-neighbor search, intersection queries, bulk loading, disk serialization, and custom storage backends, making it useful for GIS systems, spatial databases, and scientific computing.
The package has no runtime Python dependencies and supports Python 3.9 through 3.13. It is classified as production-stable with nearly 10 million monthly downloads and active maintenance, making it a mature choice for spatial indexing in Python.
Use it for
- Build a geographic information system (GIS) that queries which map features intersect a user's viewport.
- Implement nearest-neighbor search in a spatial database to find the closest points of interest to a given location.
- Index and query multi-dimensional scientific data (e.g., particle positions in a simulation) for fast spatial lookups.
- Store and retrieve spatial metadata (e.g., bounding boxes) alongside Python objects using clustered indexes.
- Bulk-load large spatial datasets and serialize the index to disk for repeated queries without rebuilding.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Rtree is a mature, actively maintained package with no known vulnerabilities, permissive MIT licensing, and broad platform support. Install friction is medium due to compiled dependencies. Choose it if you need spatial indexing for GIS, scientific computing, or spatial databases.
Install
rtree on PyPI
Before you install
Medium install friction due to compiled C dependencies. Pre-built distributions are available for most major platforms. Package is actively maintained with a recent commit on 2026-08-10 and has been stable since its early releases.
Requires libspatialindex system library; on some systems you may need to install it separately before pip install succeeds.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install rtree
from rtree import index
# Create a spatial index
idx = index.Index()
idx.insert(1, (0.0, 0.0, 1.0, 1.0))
# Query for intersecting geometries
list(idx.intersection((0.5, 0.5, 1.5, 1.5)))
Verify before relying
- Whether libspatialindex in distributed packages is current and patched for known vulnerabilities.
- Performance characteristics (index build time, query latency) for typical dataset sizes in GIS or scientific applications.
- Whether bundled libspatialindex is included in all distribution channels or requires separate installation on some platforms.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 366 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,823,017 / month, #1,497 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: DatabaseTopic :: Scientific/Engineering :: GIS |
Evidence: rtree-1.4.1-py3-none-macosx_10_9_x86_64.whl; rtree-1.4.1-py3-none-macosx_11_0_arm64.whl; rtree-1.4.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; rtree-1.4.1-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; rtree-1.4.1-py3-none-musllinux_1_2_aarch64.whl; rtree-1.4.1-py3-none-musllinux_1_2_x86_64.whl; rtree-1.4.1-py3-none-win_amd64.whl; rtree-1.4.1-py3-none-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “spatial indexing python”
- rtreeRtree wraps libspatialindex to provide spatial indexing for Python,…
- h3h3 provides Python bindings to Uber's H3 geospatial indexing library,…
- s2spheres2sphere provides Python bindings to work with S2 geometry—a…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also kdtree · pynndescent · spatial_image · spaghetti · py-geohex3 · h3 · s2sphere · usearch · access · python-geohash