2.2 KiB
PMTiles
PMTiles is a single-file archive format for tiled data. A PMTiles archive can be hosted on a commodity storage platform such as S3, and enables low-cost, zero-maintenance map applications that are "serverless" - free of a custom tile backend or third party provider.
For those familiar with Cloud Optimized GeoTIFFs - PMTiles uses similar techniques, but is specific to Z/X/Y tiles and can store vector data.
Map Libraries
Leaflet
MapLibre GL
Storage Providers
PMTiles files require servers to support HTTP byte serving as well as CORS. It's been tested with:
- Amazon S3
- Google Cloud Storage
- Microsoft Azure
- DigitalOcean Spaces
- Backblaze B2
- Your own HTTP server
Amazon S3
-
From your S3 Bucket's "Permissions" tab, scroll to the Cross-origin resource sharing (CORS) editor.
-
Add this JSON policy, replacing "https://example.com" with your domains or "*" for all domains. See The S3 CORS documentation.
[ { "AllowedHeaders": ["Range"], "AllowedMethods": ["GET","HEAD"], "AllowedOrigins": ["https://example.com"] } ]
-
Ensure that your S3 objects have public read access.
Google Cloud
-
See the Cloud Storage CORS documentation
[ { "origin": ["https://example.com"], "method": ["GET","HEAD"], "responseHeader": ["range"], "maxAgeSeconds": 300 } ]
Azure
- HEAD requests for ranges return 200 instead of 206
- Configuration through Web Portal
DigitalOcean Spaces
Backblaze B2
-
See B2 CORS Rules
[ { "corsRuleName": "allowHeaders", "allowedOrigins": ["https://example.com"], "allowedOperations":["b2_download_file_by_name"], "allowedHeaders": ["range"], "maxAgeSeconds": 300 } ]