Skip to main content

Vector Tile Proxy for PMTiles

Project description

fast-pmtiles

A high-performance FastAPI-based vector tile server for PMTiles archives.

codecov

Features

  • Remote PMTiles Support: Serve tiles directly from PMTiles archives hosted anywhere (S3, HTTP, etc.)
  • XYZ Tile API: Standard /tiles/{z}/{x}/{y} endpoint compatible with any map client that supports MVT/PBF vector tiles
  • TileJSON Support: Automatic TileJSON generation for easy client integration
  • Built-in Viewer: Simple viewer included for instant visualization

Installation

Requires Python 3.11 or higher.

  • Clone the repo

  • Install with uv:

    uv sync
    

Quick Start

  1. Run the server:

    uv run fastapi dev fast_pmtiles/main.py
    
  2. View tiles in your browser:

    http://localhost:8000/viewer?url=https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2026-01-21/places.pmtiles
    
  3. Get TileJSON description of the PMTiles source:

http://localhost:8000/tilejson.json?url=https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2026-01-21/places.pmtiles

API Endpoints

Get TileJSON

GET /tilejson.json?url={pmtiles_url}

Returns a TileJSON description of the PMTiles archive.

Parameters:

  • url: URL-encoded absolute URL of the PMTiles archive

Get Tile

GET /tiles/{z}/{x}/{y}?url={pmtiles_url}

Returns a vector tile in Mapbox Vector Tile (MVT) format.

Parameters:

  • z, x, y: Tile coordinates (zoom, x, y)
  • url: URL-encoded absolute URL of the PMTiles archive

Viewer

GET /viewer?url={pmtiles_url}

Returns an interactive HTML map viewer for visualizing the tiles.

Health Check

GET /healthz

Returns server health status.

Configuration

Configure the server using environment variables or a .env file:

# Optional: Custom server title
FAST_PMTILES_TITLE="My PMTiles Server"

# Optional: CORS origins (default: "*")
FAST_PMTILES_CORS_ORIGINS="*"

# Optional: Cache-Control header (default: "public, max-age=3600")
FAST_PMTILES_CACHE_CONTROL_STR="public, max-age=86400"

# Optional: Root path for proxy deployments (default: "")
FAST_PMTILES_ROOT_PATH="/"

Development

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/fast-pmtiles.git
    cd fast-pmtiles
    
  2. Install dependencies:

    uv sync
    
  3. Install pre-commit hooks:

    pre-commit install
    

Running Tests

uv run pytest

Code Quality

This project uses:

# Format code
ruff format

# Lint code
ruff check

Acknowledgments

This project builds on the excellent work of:

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

fast_pmtiles-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

fast_pmtiles-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file fast_pmtiles-0.1.0.tar.gz.

File metadata

  • Download URL: fast_pmtiles-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fast_pmtiles-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48cb575f73260636b0988256f717a54d01ed8eaccbfcddb5131c87f3572cd86b
MD5 fe3a75a3de3b4d862c5c96ea16d68120
BLAKE2b-256 2088ea81b8aa88ffc9955be7f7c8b196153487b7ca5767788e326ea12b77a8c4

See more details on using hashes here.

File details

Details for the file fast_pmtiles-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fast_pmtiles-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fast_pmtiles-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67b44fca8fc464c50135902ec08e483f16f8c04340a03158afad268f1541c601
MD5 fdd99a0b01cb1401ef314a7658173235
BLAKE2b-256 800bfb2180d435d4b3cc2ae43eff8080de32cc46822152469f65f0838c852140

See more details on using hashes here.

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