Skip to main content

rio-pmtiles

A plugin for the Rasterio CLI that exports a raster dataset to the PMTiles (version 3) format. Features include automatic reprojection and concurrent tile generation.

This is derived from the original rio-mbtiles CLI by Sean Gillies at Mapbox. See CHANGELOG.md for differences.

Usage

Usage: rio pmtiles [OPTIONS] INPUT [OUTPUT]

  Export a dataset to PMTiles (version 3).

  The input dataset may have any coordinate reference system. It must have
  at least three bands, which will be become the red, blue, and green bands
  of the output image tiles.

  An optional fourth alpha band may be copied to the output tiles by using
  the --rgba option in combination with the PNG or WEBP formats. This option
  requires that the input dataset has at least 4 bands.

  The default quality for JPEG and WEBP output (possible range: 10-100) is
  75. This value can be changed with the use of the QUALITY creation option,
  e.g. `--co QUALITY=90`.  The default zlib compression level for PNG output
  (possible range: 1-9) is 6. This value can be changed like `--co
  ZLEVEL=8`.  Lossless WEBP can be chosen with `--co LOSSLESS=TRUE`.

  If no zoom levels are specified, the defaults are the zoom levels nearest
  to the one at which one tile may contain the entire source dataset.

  If a title or description for the output file are not provided, they will
  be taken from the input dataset's filename.

  This command is suited for small to medium (~1 GB) sized sources.

  Python package: rio-pmtiles (https://github.com/protomaps/PMTiles).

Options:
  -o, --output PATH               Path to output file (optional alternative to
                                  a positional arg).

  --name TEXT                     PMTiles metadata name.
  --description TEXT              PMTiles metadata description.
  --attribution TEXT              PMTiles metadata attribution.
  --overlay                       Export as an overlay (the default).
  --baselayer                     Export as a base layer.
  -f, --format [JPEG|PNG|WEBP]    Tile image format.  [default: WEBP]
  --tile-size INTEGER             Width and height of individual square tiles
                                  to create.  [default: 512]

  --zoom-levels MIN..MAX          A min...max range of export zoom levels. The
                                  default zoom level is the one at which the
                                  dataset is contained within a single tile.

  -j INTEGER                      Number of workers (default: number of
                                  computer's processors).

  --src-nodata FLOAT              Manually override source nodata
  --dst-nodata FLOAT              Manually override destination nodata
  --resampling [nearest|bilinear|cubic|cubic_spline|lanczos|average|mode|gauss|max|min|med|q1|q3|rms]
                                  Resampling method to use.  [default:
                                  bilinear]

  --version                       Show the version and exit.
  --rgba                          Select RGBA output. For PNG or WEBP only.

  -#, --progress-bar              Display progress bar.
  --cutline PATH                  Path to a GeoJSON FeatureCollection to be
                                  used as a cutline. Only source pixels within
                                  the cutline features will be exported.

  --oo NAME=VALUE                 Format driver-specific options to be used
                                  when accessing the input dataset. See the
                                  GDAL format driver documentation for more
                                  information.

  --co, --profile NAME=VALUE      Driver specific creation options. See the
                                  documentation for the selected output driver
                                  for more information.

  --wo NAME=VALUE                 See the GDAL warp options documentation for
                                  more information.

  --exclude-empty-tiles / --include-empty-tiles
                                  Whether to exclude or include empty tiles
                                  from the output.

  --help                          Show this message and exit.

Performance

The rio-pmtiles command is suited for small to medium (~1 GB) raster sources. On a MacBook Pro M1, the 1:10M scale Natural Earth raster (a 21,600 x 10,800 pixel, 700 MB TIFF) exports to PMTiles (levels 1 through 5) in 15 seconds.

$ time GDAL_CACHEMAX=256 rio pmtiles NE1_HR_LC.tif \
> -o ne.pmtiles --zoom-levels 1..5 -j 4

14.87s user 10.40s system 258% cpu 9.787 total

Installation

pip install rio-pmtiles

Metadata

Release files for rio-pmtiles 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rio-pmtiles 1.2.2
File Size Uploaded
rio_pmtiles-1.2.2.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rio-pmtiles 1.2.2
File Interpreter ABI Platform
rio_pmtiles-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / rio_pmtiles-1.2.2.tar.gz

Download URL rio_pmtiles-1.2.2.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
acdccb703002c1a4929da86fe3225f26720f4d9592412d6e3fba550fbcd191fd
BLAKE2b-256 checksum
How to use checksums
a552e73f6db56aa44d9c5d029562f175305e7c075d9f9817b138054c8be9c621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / rio_pmtiles-1.2.2-py3-none-any.whl

Download URL rio_pmtiles-1.2.2-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef715f256b4713693c3f33d6124debfcff1760373ef327f2d58cdf31667c7919
BLAKE2b-256 checksum
How to use checksums
57e121ddd145b85a79fdffcfeb63b61ae1cdfed8c716659e7a58b2a6ebf65106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page