Conversations
PMTiles approach lowers barrier to self-hosting map tile deployment
A technical article introduces the PMTiles format in the Protomaps ecosystem: map tiles can be packaged into a single file, read through HTTP Range requests, and deployed to object storage. Using Bunny.net as an example, the author explains the costs and configuration, saying the world map file is about 139GB, storage with fivefold replication costs about $5 per month, and zooming through a European city once transfers about 5MB.
PMTiles is a tile format in the Protomaps ecosystem whose core feature is placing map tiles in a single file and reading them on demand through HTTP Range requests, making it easy to migrate and deploy. For CDNs that support caching of Range requests for large files, it is basically only necessary to download and upload the file; for services such as Cloudflare where the path model differs, edge functions can be used to convert between traditional x/y/z tile URLs and Range requests.
The author said they came across the approach while researching the Mapboard project because commercial map APIs can become expensive for noncommercial projects once traffic rises. As an example, the article says Mapbox charges $5 per 1,000 map loads after the free quota is used up. By contrast, PMTiles can be hosted directly in a storage bucket. To obtain a world map, one can download a daily build or use command-line tools to crop by bounding box or zoom level to obtain a smaller file.
Using Bunny.net as an example, the article says it supports HTTP Range requests, does not collect personal data by default, is headquartered in the European Union, and provides a global CDN and edge storage. Prices vary by region and replication factor: traffic to Europe and North America is generally $0.01 per GB, while the smaller Volume network is $0.005 per GB; storage without replication is $0.01 per GB per month, and the highest replication level is $0.055 per GB per month.
According to the author’s calculation, distributing the 139GB world map across most continents with fivefold replication costs about $5 per month in storage fees; loading the map of Europe on a laptop and zooming in to a city transfers about 5MB, costing about $0.00005, with later browsing costing less because of local caching. Estimated at $0.05 per 1,000 map loads, the author says it could be 100 times cheaper than Mapbox, though actual traffic varies with how long users stay and how they interact. For deployment, the author recommends enabling an S3-compatible storage bucket and using rclone through tmux or a temporary VPS for uploads to avoid timeouts after 15 minutes with HTTP API uploads; when configuring a pull zone, CORS or allowed origins should also be set to prevent other websites from directly embedding the tiles.