6 releases
Uses new Rust 2024
| 0.6.2 | Oct 27, 2025 |
|---|---|
| 0.6.1 | Oct 16, 2025 |
| 0.1.0-beta.1 | Oct 4, 2024 |
#358 in Geospatial
630 downloads per month
1MB
24K
SLoC
pyo3-geoarrow
PyO3 bindings for GeoArrow types, enabling seamless integration between Rust's GeoArrow implementation and Python.
This crate provides Python-compatible wrappers around GeoArrow data structures, allowing Python code to efficiently work with and share geospatial data in the GeoArrow format through the Arrow C Data Interface (using the Arrow PyCapsule Interface) without data copies.
Features
- Zero-copy data exchange: Use Arrow's C Data Interface for efficient memory sharing between Rust and Python.
- GeoArrow types: Python bindings for GeoArrow geometry arrays, scalars, and metadata.
- Type safety: Strongly-typed wrappers that preserve GeoArrow's type system in Python.
- FFI support: Import and export GeoArrow data to/from Python using the Arrow PyCapsule Interface.
Core Types
PyGeoArray: Python wrapper for GeoArrow geometry arraysPyGeoChunkedArray: Python wrapper for chunked GeoArrow geometry arraysPyGeoArrayReader: Python wrapper for streaming array readersPyGeoScalar: Python wrapper for GeoArrow scalar geometriesPyGeoType: Python wrapper for GeoArrow data typesPyCrs: Python wrapper for coordinate reference system representation
Usage
This crate is primarily intended for use by Python binding developers who need to interoperate with GeoArrow data in Python. It is also used internally by the geoarrow-rust-* Python packages.
use std::sync::Arc;
use pyo3::prelude::*;
use pyo3_geoarrow::PyGeoArray;
use geoarrow_array::GeoArrowArray;
#[pyfunction]
fn process_geometry(py: Python, array: PyGeoArray) -> PyResult<PyGeoArray> {
// Access the underlying GeoArrow array
let inner: Arc<dyn GeoArrowArray> = array.into_inner();
// Perform operations...
Ok(PyGeoArray::new(inner))
}
Integration with Arrow
This crate implements the Arrow PyCapsule Interface, allowing GeoArrow objects to be exchanged with any Python library that supports Arrow, including:
- PyArrow
- Polars (once they support extension types)
- GeoPandas (via PyArrow)
- DuckDB
Dependencies
This crate builds on:
pyo3: Python bindings for Rustpyo3-arrow: Arrow integration for PyO3geoarrow-array: Core GeoArrow array typesgeoarrow-schema: GeoArrow type system and metadata
Dependencies
~43MB
~610K SLoC