Skip to main content

Fast I/O and transformation tools for GeoParquet files

Project description

geoparquet-io

Tests Python Version License Code style: ruff

Fast I/O and transformation tools for GeoParquet files using PyArrow and DuckDB.

Features

  • Fast: Built on PyArrow and DuckDB for high-performance operations
  • Comprehensive: Sort, partition, enhance, and validate GeoParquet files
  • Spatial Indexing: Add bbox, H3 hexagonal cells, KD-tree partitions, and admin divisions
  • Best Practices: Automatic optimization following GeoParquet 1.1 spec
  • Flexible: CLI and Python API for any workflow
  • Tested: Extensive test suite across Python 3.9-3.13 and all platforms

Installation

# With uv (recommended)
uv pip install geoparquet-io

# Or with pip
pip install geoparquet-io

# From source
git clone https://github.com/cholmes/geoparquet-io.git
cd geoparquet-io
uv sync --all-extras

For full development set up see the getting started instructions.

Requirements

  • Python 3.9 or higher
  • PyArrow 12.0.0+
  • DuckDB 1.1.3+

Quick Start

# Inspect file structure and metadata
gpio inspect myfile.parquet

# Check file quality and best practices
gpio check all myfile.parquet

# Add bounding box column for faster queries
gpio add bbox input.parquet output.parquet

# Sort using Hilbert curve for spatial locality
gpio sort hilbert input.parquet output_sorted.parquet

# Partition into separate files by country
gpio partition admin buildings.parquet output_dir/

Documentation

Full documentation is available at: https://cholmes.github.io/geoparquet-io/

Usage Examples

Inspect and Validate

# Quick metadata inspection
gpio inspect data.parquet

# Preview first 10 rows
gpio inspect data.parquet --head 10

# Check against best practices
gpio check all data.parquet

Enhance with Spatial Indices

# Add bounding boxes
gpio add bbox input.parquet output.parquet

# Add H3 hexagonal cell IDs
gpio add h3 input.parquet output.parquet --resolution 9

# Add KD-tree partition IDs (auto-balanced)
gpio add kdtree input.parquet output.parquet

# Add country codes via spatial join
gpio add admin-divisions buildings.parquet output.parquet

Optimize and Partition

# Sort by Hilbert curve
gpio sort hilbert input.parquet sorted.parquet

# Partition by H3 cells
gpio partition h3 large.parquet output_dir/ --resolution 7

# Partition by country
gpio partition admin buildings.parquet by_country/

Python API

from geoparquet_io.core.add_bbox_column import add_bbox_column
from geoparquet_io.core.hilbert_order import hilbert_order

# Add bounding box
add_bbox_column("input.parquet", "output.parquet", verbose=True)

# Sort by Hilbert curve
hilbert_order("input.parquet", "sorted.parquet", add_bbox=True)

Contributing

Contributions are welcome! See our Contributing Guide for details.

Development

# Clone repository
git clone https://github.com/cholmes/geoparquet-io.git
cd geoparquet-io

# Install with all development dependencies
uv sync --all-extras

# Run tests
uv run pytest

# Run linting
uv run ruff check .

# Build docs locally
uv run mkdocs serve

License

Apache 2.0 - See LICENSE for details.

Links

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

geoparquet_io-0.2.0.tar.gz (262.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoparquet_io-0.2.0-py3-none-any.whl (62.2 kB view details)

Uploaded Python 3

File details

Details for the file geoparquet_io-0.2.0.tar.gz.

File metadata

  • Download URL: geoparquet_io-0.2.0.tar.gz
  • Upload date:
  • Size: 262.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geoparquet_io-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c533dc75fe36e19d32b9068ec1d95d051dee445dfbe3944a976bc5262349ff6f
MD5 b631117535b1b40be6b959e032032603
BLAKE2b-256 ea69abb216e34705569ca6cae2a206439d4a1503f6490b3114931840b8d85843

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoparquet_io-0.2.0.tar.gz:

Publisher: publish.yml on cholmes/geoparquet-io

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geoparquet_io-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: geoparquet_io-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 62.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geoparquet_io-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95feedb41efddeb5aa74c9b462ef9946240bdb42a651ff6379066b7ae567bf00
MD5 838dcdad3d40903317f33d192ea7115f
BLAKE2b-256 5049a05e85110da21fa30b466a1d9fc9c20d49575a800d5b3d76a99392aff5e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoparquet_io-0.2.0-py3-none-any.whl:

Publisher: publish.yml on cholmes/geoparquet-io

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page