### Inspect a PMTiles archive Source: https://docs.protomaps.com/guide/getting-started Use the pmtiles CLI to inspect the metadata of a daily basemap build. ```bash pmtiles show https://build.protomaps.com/20260526.pmtiles ``` -------------------------------- ### Example PMTiles URL Source: https://docs.protomaps.com/deploy An example of a PMTiles archive URL. ```text https://s3.mycloudstorage.com/world.pmtiles ``` -------------------------------- ### Extract a subset of a planet file by bounding box Source: https://docs.protomaps.com/guide/getting-started Create a subset of a planet file with tiles matching a specific bounding box. ```bash pmtiles extract https://build.protomaps.com/20260526.pmtiles my_area.pmtiles --bbox=4.742883,51.830755,5.552837,52.256198 ``` -------------------------------- ### Extract a subset of a planet file by max zoom Source: https://docs.protomaps.com/guide/getting-started Create a subset of a planet file with tiles up to a specified maximum zoom level. ```bash pmtiles extract https://build.protomaps.com/20260526.pmtiles planet_z6.pmtiles --maxzoom=6 ``` -------------------------------- ### pmtiles serve command example Source: https://docs.protomaps.com/pmtiles/cli Example of the 'serve' command to expose tilesets as a ZXY endpoint. ```bash pmtiles serve . ``` -------------------------------- ### pmtiles show command examples Source: https://docs.protomaps.com/pmtiles/cli Examples of the 'show' command for pmtiles. ```bash pmtiles show INPUT.pmtiles ``` ```bash pmtiles show INPUT.pmtiles --bucket=s3://BUCKET_NAME ``` ```bash pmtiles show INPUT.pmtiles --header-json ``` ```bash pmtiles show INPUT.pmtiles --metadata ``` -------------------------------- ### Install @protomaps/basemaps Source: https://docs.protomaps.com/basemaps/maplibre Command to install the @protomaps/basemaps NPM package. ```bash npm install @protomaps/basemaps ``` -------------------------------- ### Example CDN Tile URLs Source: https://docs.protomaps.com/deploy Examples of how PMTiles archives can be served as standard Z/X/Y tile URLs via a CDN. ```text https://tiles.myglobalcdn.com/myvectordata/{z}/{x}/{y}.mvt https://tiles.myglobalcdn.com/myrasterdata/{z}/{x}/{y}.png ``` -------------------------------- ### Install pmtiles library Source: https://docs.protomaps.com/pmtiles/maplibre Install the pmtiles JavaScript library using npm. ```bash npm install pmtiles ``` -------------------------------- ### CloudFront URL Examples Source: https://docs.protomaps.com/deploy/aws Example URLs for accessing the TileJSON and tile endpoints after CloudFormation deployment. ```text https://SUBDOMAIN.cloudfront.net/TILESET.json # TileJSON for MapLibre https://SUBDOMAIN.cloudfront.net/TILESET/{z}/{x}/{y}.{ext} ``` -------------------------------- ### pmtiles tile command example Source: https://docs.protomaps.com/pmtiles/cli Example of the 'tile' command to output a single tile's contents. ```bash pmtiles tile INPUT.pmtiles 0 0 0 ``` -------------------------------- ### pmtiles merge command examples Source: https://docs.protomaps.com/pmtiles/cli Examples of the 'merge' command for combining disjoint archives. ```bash pmtiles merge INPUT_1.pmtiles INPUT_2.pmtiles OUTPUT.pmtiles ``` ```bash pmtiles merge INPUT_1.pmtiles INPUT_2.pmtiles INPUT_3.pmtiles OUTPUT.pmtiles ``` -------------------------------- ### Install via npm Source: https://docs.protomaps.com/basemaps/leaflet Command to install the protomaps-leaflet library using npm for use with a bundler. ```bash npm add protomaps-leaflet ``` -------------------------------- ### pmtiles extract command examples Source: https://docs.protomaps.com/pmtiles/cli Examples of the 'extract' command for creating smaller archives. ```bash pmtiles extract INPUT.pmtiles OUTPUT.pmtiles --bbox=MIN_LON,MIN_LAT,MAX_LON,MAX_LAT ``` ```bash pmtiles extract INPUT.pmtiles OUTPUT.pmtiles --region=REGION.geojson ``` ```bash pmtiles extract https://example.com/INPUT.pmtiles OUTPUT.pmtiles --maxzoom=MAXZOOM ``` ```bash pmtiles extract INPUT.pmtiles OUTPUT.pmtiles --maxzoom=MAXZOOM --bucket=s3://BUCKET_NAME ``` -------------------------------- ### Example PMTiles URLs Source: https://docs.protomaps.com/deploy/google-cloud Example URLs to access the tileset served by the Cloud Run container. Includes the base URL for vector tiles and a URL for TileJSON. ```http https://EXAMPLE.REGION.run.app/TILESET/0/0/0.mvt ``` ```http https://EXAMPLE.REGION.run.app/TILESET.json # TileJSON,requires --public-url to be set ``` -------------------------------- ### pmtiles verify command example Source: https://docs.protomaps.com/pmtiles/cli Example of the 'verify' command to check archive integrity. ```bash pmtiles verify INPUT.pmtiles ``` -------------------------------- ### Zürich Example Source: https://docs.protomaps.com/basemaps/localization Example of a name with only the Latin script. ```text name = Zürich (script absent) (name2 absent) (script2 absent) (name3 absent) (script3 absent) ``` -------------------------------- ### Example Application HTML Source: https://docs.protomaps.com/guide/security-privacy A complete HTML example of a map application that avoids third-party data processors, assuming all linked assets are hosted on compliant static storage. ```html
``` -------------------------------- ### Casablanca Example Source: https://docs.protomaps.com/basemaps/localization Example of a name with Latin, Tifinagh, and Arabic scripts, split into 'name', 'name2', and 'name3'. ```text name = Casablanca (script absent) name2 = ⵜⵉⴳⵎⵉ ⵜⵓⵎⵍⵉⵍⵜ script2 = Tifinagh name3 = الدار البيضاء script3 = Arabic ``` -------------------------------- ### Example curl requests for vector tiles and TileJSON Source: https://docs.protomaps.com/deploy/cloudflare Demonstrates how to fetch vector tiles and TileJSON using curl. ```bash curl -v https://subdomain.mydomain.com/FILENAME/0/0/0.mvt # TileJSON for MapLibre curl -v https://subdomain.mydomain.com/FILENAME.json ``` -------------------------------- ### Hong Kong Example Source: https://docs.protomaps.com/basemaps/localization Example of a name with Han and Latin scripts, split into 'name' and 'name2'. ```text name = 香港 script = Han name2 = Hong Kong (script2 absent) (name3 absent) (script3 absent) ``` -------------------------------- ### Show local archive Source: https://docs.protomaps.com/pmtiles/cli Example of showing a local tileset archive. ```sh pmtiles show test.pmtiles ``` -------------------------------- ### Example: Milano (English localization) Source: https://docs.protomaps.com/basemaps/localization Demonstrates how place names are displayed for English localization, prioritizing the English name when the local name uses the same script. ```text Milan ``` -------------------------------- ### Raster Tiles Example Source: https://docs.protomaps.com/pmtiles/openlayers Example of using PMTiles with OpenLayers for raster tiles (RGB Terrain). ```javascript import "./style.css"; import { Map, View } from "ol"; import WebGLTile from "ol/layer/WebGLTile"; import { PMTilesRasterSource } from "ol-pmtiles"; import { useGeographic } from 'ol/proj'; const rasterLayer = new WebGLTile({ source: new PMTilesRasterSource({ url:"https://r2-public.protomaps.com/protomaps-sample-datasets/terrarium_z9.pmtiles", attributions:["https://github.com/tilezen/joerd/blob/master/docs/attribution.md"], tileSize: [512,512] }) }); useGeographic(); const map = new Map({ target: "map", layers: [rasterLayer], view: new View({ center: [0,0], zoom: 1, }), }); ``` -------------------------------- ### Dual Language Labels Example Source: https://docs.protomaps.com/basemaps/localization Example JSON snippet for a MapLibre Style to display labels in two languages (Dutch and French in this case). ```json "text-field": [ "case", [ "all", ["has", "name:nl"], ["has", "name:fr"], ], // both languages are present [ "case", ["==", ["get", "name:nl"], ["get", "name:fr"]], // both languages are identical, only show one ["get", "name:nl"], // languages not identical, show both [ "format", ["get", "name:nl"], {}, "\n", {}, ["get", "name:fr"], {}, ], ], [ "all", ["!", ["has", "name:nl"]], ["!", ["has", "name:fr"]], ], // none of the languages is present, use default ["get", "name"], // only one language is present ["coalesce", "name:nl", "name:fr"] ] ``` -------------------------------- ### Vector Tiles Example Source: https://docs.protomaps.com/pmtiles/openlayers Example of using PMTiles with OpenLayers for vector tiles (New Zealand buildings). ```javascript import "./style.css"; import { Map, View } from "ol"; import VectorTile from "ol/layer/VectorTile"; import { PMTilesVectorSource } from "ol-pmtiles"; import { Style, Stroke, Fill } from 'ol/style'; import { useGeographic } from 'ol/proj'; const vectorLayer = new VectorTile({ declutter: true, source: new PMTilesVectorSource({ url: "https://r2-public.protomaps.com/protomaps-sample-datasets/nz-buildings-v3.pmtiles", attributions: ["© Land Information New Zealand"], }), style: new Style({ stroke: new Stroke({ color: "gray", width: 1, }), fill: new Fill({ color: "rgba(20,20,20,0.9)", }), }), }); useGeographic(); const map = new Map({ target: "map", layers: [vectorLayer], view: new View({ center: [172.606201,-43.556510], zoom: 7, }), }); ``` -------------------------------- ### Content Security Policy Example Source: https://docs.protomaps.com/guide/security-privacy Example of an HTML meta tag for a Content Security Policy (CSP) that enforces resource origins and includes directives for MapLibre. ```html ``` -------------------------------- ### Caddy CORS Configuration Source: https://docs.protomaps.com/pmtiles/cloud-storage Example CORS headers configuration for Caddy when serving PMTiles. ```text Access-Control-Allow-Methods GET,HEAD Access-Control-Expose-Headers ETag Access-Control-Allow-Headers Range,If-Match Access-Control-Allow-Origin http://example.com ``` -------------------------------- ### Rclone Docker usage Source: https://docs.protomaps.com/pmtiles/cloud-storage Example of uploading to cloud storage using the rclone Docker image. ```sh rclone copyto :/ --progress --s3-no-check-bucket --s3-chunk-size=256M ``` -------------------------------- ### Cloud storage commands Source: https://docs.protomaps.com/pmtiles/cli Examples of using pmtiles with cloud storage buckets (S3, Azure Blob, Google Cloud Storage). ```sh pmtiles show test.pmtiles --bucket=s3://BUCKET_NAME ``` ```sh pmtiles show test.pmtiles --bucket=azblob://CONTAINER_NAME?storage_account=ACCOUNT ``` ```sh pmtiles show test.pmtiles --bucket=gs://BUCKET_NAME ``` -------------------------------- ### S3-compatible storage endpoint Source: https://docs.protomaps.com/pmtiles/cli Example of connecting to S3-compatible blob storage outside of AWS. ```sh pmtiles show test.pmtiles --bucket=s3://BUCKET_NAME?endpoint=https://example.com®ion=auto ``` -------------------------------- ### Rclone upload command Source: https://docs.protomaps.com/pmtiles/cloud-storage Example of using rclone to copy a file to S3-compatible storage. ```sh rclone copyto my-filename my-configuration:my-bucket/my-folder/my-filename.pmtiles --progress --s3-chunk-size=256M ``` -------------------------------- ### Example: Milano (Greek localization) Source: https://docs.protomaps.com/basemaps/localization Illustrates how place names are displayed for Greek localization, including both the Greek name and the local name (Milano) because they use different scripts. ```text Μιλάνο Milano ``` -------------------------------- ### Subresource Integrity Example Source: https://docs.protomaps.com/guide/security-privacy Example of using Subresource Integrity (SRI) to ensure the integrity of a loaded JavaScript library from a third-party CDN. ```html