--- id: rtree version: "1.4.1" license: MIT license_treatment: permissive maintenance: active --- # rtree — R-Tree spatial index for Python GIS License: permissive · Maintenance: active · Downloads: 9.8M/mo ## 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 above — verify before relying. Rtree wraps libspatialindex to provide spatial indexing for Python, enabling nearest-neighbor search, intersection queries, and multi-dimensional spatial data structures. 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 pip install rtree uv add rtree poetry add rtree ## Installing rtree 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. 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))) Requires libspatialindex system library; on some systems you may need to install it separately before pip install succeeds. 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_current - Install friction: medium - Maintenance: active - Downloads: 9.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags spatial indexing python, r-tree nearest neighbor, spatial database index, geographic data indexing, intersection search spatial, multi-dimensional spatial queries, gis spatial index, spatial-indexing, gis, r-tree [View on SkillFed](https://skillfed.io/packages/rtree) · [View on PyPI](https://pypi.org/project/rtree/)