Skip to main content

PMTiles generation plugin for geoparquet-io

Project description

gpio-pmtiles

⚠️ DEPRECATED: This plugin is deprecated. PMTiles support is now built into geoparquet-io core. Use gpio pmtiles create (CLI) or geoparquet_io.api.ops.create_pmtiles() (Python). See the GeoJSON guide for usage.

Python Version License Code style: ruff

PMTiles generation plugin for geoparquet-io.

Overview

This plugin provides integrated PMTiles generation from GeoParquet files by orchestrating a streaming pipeline:

GeoParquet → [reproject] → [filter] → [convert to GeoJSON] → [tippecanoe] → PMTiles

All filtering, reprojection, and conversion happens in-memory through Unix pipes—no intermediate files needed.

Why use this plugin instead of manual piping?

  • Simpler API: Single command handles the entire pipeline with sensible defaults
  • Built-in CRS handling: Automatically reprojects to WGS84 if needed
  • Better error messages: Clear guidance for common issues (tippecanoe missing, invalid paths)
  • Quality defaults: Pre-configured tippecanoe settings for production use

Installation

# As a CLI tool
uv tool install geoparquet-io --with gpio-pmtiles

# For Python library use
pip install geoparquet-io gpio-pmtiles

Requirements:

  • tippecanoe must be installed and available in PATH
    • macOS: brew install tippecanoe
    • Ubuntu: sudo apt install tippecanoe

Quick Start

# Basic conversion
gpio pmtiles create buildings.parquet buildings.pmtiles

# With spatial filtering
gpio pmtiles create data.parquet filtered.pmtiles \
  --bbox "-122.5,37.5,-122.0,38.0"

# With attribute filtering and column selection
gpio pmtiles create data.parquet cities.pmtiles \
  --where "population > 10000" \
  --include-cols name,population,area

# With CRS override (if metadata is incorrect)
gpio pmtiles create data.parquet tiles.pmtiles --src-crs EPSG:3857

# From S3 with AWS profile
gpio pmtiles create s3://bucket/data.parquet tiles.pmtiles --profile my-aws-profile

Python API

The plugin also provides a Python API:

from gpio_pmtiles import create_pmtiles_from_geoparquet

# Basic usage
create_pmtiles_from_geoparquet(
    input_path="buildings.parquet",
    output_path="buildings.pmtiles"
)

# With filtering
create_pmtiles_from_geoparquet(
    input_path="data.parquet",
    output_path="tiles.pmtiles",
    bbox="-122.5,37.5,-122.0,38.0",
    where="population > 10000",
    include_cols="name,type,height",
    min_zoom=0,
    max_zoom=14
)

# With CRS override
create_pmtiles_from_geoparquet(
    input_path="data.parquet",
    output_path="tiles.pmtiles",
    src_crs="EPSG:3857"  # Reproject from EPSG:3857 to WGS84
)

CLI Options

Option Description
--layer, -l Layer name in PMTiles (defaults to output filename)
--min-zoom Minimum zoom level (use with --max-zoom or auto-detect)
--max-zoom Maximum zoom level (auto-detected if not specified)
--bbox Bounding box filter: minx,miny,maxx,maxy
--where SQL WHERE clause for filtering rows
--include-cols Comma-separated list of columns to include
--precision Coordinate decimal precision (default: 6 for ~10cm accuracy)
--src-crs Source CRS if metadata is incorrect (will reproject to WGS84)
--attribution Attribution HTML for tiles (defaults to geoparquet-io link)
--profile AWS profile name for S3 files
--verbose, -v Show progress and commands being executed

How It Works

Plugin System

This plugin uses the entry points system to register itself with geoparquet-io. When installed, it automatically adds the pmtiles command group to the gpio CLI.

Pipeline Architecture

The plugin orchestrates a subprocess pipeline:

  1. Reprojection (if --src-crs specified): gpio convert reproject
  2. Filtering (if bbox/where/include-cols specified): gpio extract
  3. GeoJSON conversion: gpio convert geojson with streaming output
  4. Tile generation: tippecanoe with production-quality settings

All stages communicate through Unix pipes for memory efficiency. No intermediate files are created.

Manual Pipeline Alternative

If you prefer manual control, you can achieve the same result with pipe commands:

# Plugin version (simple)
gpio pmtiles create data.parquet tiles.pmtiles --bbox "-122,37,-121,38"

# Equivalent manual pipeline
gpio extract data.parquet --bbox "-122,37,-121,38" | \
  gpio convert geojson - | \
  tippecanoe -P -o tiles.pmtiles -zg --simplify-only-low-zooms

The plugin provides better defaults and error handling, but manual piping offers more flexibility.

Coordinate Precision

The --precision option controls decimal places for coordinates:

Precision Accuracy Use Case
7 ~1cm High accuracy applications
6 (default) ~10cm Most mapping use cases
5 ~1m City-level visualization
4 ~10m Regional maps
# Reduce precision for smaller files
gpio pmtiles create data.parquet output.pmtiles --precision 5

Development

Contributions are welcome! See CLAUDE.md for development guidelines

# Clone and install
git clone https://github.com/geoparquet/gpio-pmtiles.git
cd gpio-pmtiles
uv sync --all-extras

# Run tests
uv run pytest

# Format and lint
uv run ruff format .
uv run ruff check --fix .

Related Documentation

Links

License

Apache 2.0

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

gpio_pmtiles-0.2.0.tar.gz (196.0 kB view details)

Uploaded Source

Built Distribution

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

gpio_pmtiles-0.2.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gpio_pmtiles-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ce51abb350eb484325c1e30dc60cd82f20d8190f0ff3b641d5ff800af1d1c46c
MD5 4b1ddeedd8c58603016106a3835a045e
BLAKE2b-256 cb7d35f870fa181a96bf4395bd54196b5118483e11daf25737754cf736213dfa

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on geoparquet-io/gpio-pmtiles

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

File details

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

File metadata

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

File hashes

Hashes for gpio_pmtiles-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a1d7e3d9e7faed24c11128e0fd2470ac9e7e478428a5480ec8a6dc66c22257d
MD5 55d36981a12d595b73415c85feb5ec96
BLAKE2b-256 fbe91d8173559da8f35957bb6e5d208ef2584674f1c467558a2234d052a31630

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on geoparquet-io/gpio-pmtiles

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