PMTiles is a single-file archive format for pyramids of tiled data. A PMTiles archive can be hosted on a storage platform like S3, and enables low-cost, zero-maintenance map applications.
PMTiles is a general format for tiled data addressed by Z/X/Y coordinates. This can be cartographic basemap vector tiles, remote sensing observations, JPEG images, or more.
PMTiles readers use HTTP Range Requests to fetch only the relevant tile or metadata inside a PMTiles archive on-demand.
The arrangement of tiles and directories is designed to minimize the amount of overhead requests when panning and zooming.
The current specification version of PMTiles is version 3, which you can read on GitHub.
pmtiles command line tool
The official tool for reading and writing PMTiles is the
pmtiles command line utility.
Download pre-compiled binaries for your platform at GitHub Releases.
Examples and source code for
pmtiles are in the README for go-pmtiles on GitHub.
Documentation is available on GitHub.
1. Download an area
Protomaps Downloads is a free service to download up-to-date basemap tilesets from OpenStreetMap.
We'll focus on a small area of Berkeley, CA, but you can follow these instructions for any area. Use the search box and the rectangle or polygon tool to draw the area you're interested in:
2. Serve your file locally
You'll need to use any local HTTP server that supports Range Requests to test the file locally. the npm package
http-server is a popular one:
npm install -g http-server # from the directory containing your .pmtiles file http-server . --cors # your file is now available at http://localhost:8080/
You can also use the HTTP server built into your frontend framework, usually by placing the .pmtiles file into the
3. Display the tiles in a map frontend
With your own data
pmtiles command line tool converts MBTiles to PMTiles with this command:
pmtiles convert INPUT.mbtiles OUTPUT.pmtiles
Tippecanoe is the supported tool for converting datasets into tiles.
A future version of Tippecanoe will support PMTiles output directly.
An example of how to convert a Shapefile: US Census Bureau Tabulation Areas in two steps, using GDAL's
ogr2ogr command line tool:
ogr2ogr -t_srs EPSG:4326 cb_2018_us_zcta510_500k.json cb_2018_us_zcta510_500k.shp # Creates a layer in the vector tiles named "zcta" tippecanoe -zg --projection=EPSG:4326 -o cb_2018_us_zcta510_500k_nolimit.mbtiles -l zcta cb_2018_us_zcta510_500k.json pmtiles convert cb_2018_us_zcta510_500k_nolimit.mbtiles cb_2018_us_zcta510_500k.pmtiles
Edit OpenStreetMap and download basemaps to get new data. Your improvements to the map are available for anyone!
Learn how to customize your map's Basemap Layers.