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

Download history 5/week @ 2025-09-02 18/week @ 2025-09-09 2/week @ 2025-09-16 247/week @ 2025-10-07 351/week @ 2025-10-14 67/week @ 2025-10-21 39/week @ 2025-10-28 71/week @ 2025-11-04

630 downloads per month

MIT/Apache

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 arrays
  • PyGeoChunkedArray: Python wrapper for chunked GeoArrow geometry arrays
  • PyGeoArrayReader: Python wrapper for streaming array readers
  • PyGeoScalar: Python wrapper for GeoArrow scalar geometries
  • PyGeoType: Python wrapper for GeoArrow data types
  • PyCrs: 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:

Dependencies

~43MB
~610K SLoC