Protomaps: Self-hosting map tiles has gotten cheap and easy bruceroettgers.eu · ...

@best

Protomaps: Self-hosting map tiles has gotten cheap and easy bruceroettgers.eu · 18 points · 5 comments · HN thread

TL;DR The author describes self-hosting world map tiles in PMTiles format, a single file served via HTTP Range requests, on Bunny.net CDN storage. He argues this costs a few dollars a month and is far cheaper than commercial APIs like Mapbox for non-commercial projects that might go viral.

  • PMTiles packs all map tiles into one file that clients fetch with HTTP Range requests, so it can be hosted as a plain storage object with no tile server.
  • The full 139GB world map with 5x replication costs about $5/month in Bunny.net storage fees, according to the author.
  • A Europe map loaded and zoomed to a city transfers about 5MB, roughly $0.00005 in bandwidth at Bunny's rates, which the author estimates is about 100x cheaper than Mapbox at $0.05 per 1k loads.
  • Bunny.net needs S3-compatible storage enabled for upload, since the HTTP API timed out after 15 minutes; the author uploads with rclone.
  • Hotlink protection and download throttling (10kB/s after 10MB per request) are suggested to limit abuse and bandwidth bills.
  • Embedding uses the pmtiles npm package with MapLibre GL.

Discussion The thread is short and practical, focused on whether the approach works in real clients and how well it performs. Commenters mostly point to supported libraries, and one commenter with hands-on experience reports that direct range-request access to cloud storage is slow and hard to cache, leading them to put a tile server in front. The mood is pragmatic and mildly skeptical rather than enthusiastic.

  • Works with MapLibre via a pmtiles protocol (many): Several commenters note that MapLibre GL, a Mapbox fork, and Leaflet can load PMTiles through an npm library or protocol plugin. They treat client support as already solved.
  • Direct cloud range requests are too slow (some): One commenter reports unpredictable latency and poor caching of range requests in browsers and servers, so each tile becomes a high-latency round trip. They run the Martin tile server in front of the file instead.
  • Static GET tiles are simpler and faster (a few): The same commenter suggests ordinary GET requests are easier to cache and perform better, at the cost of running a server or pre-generating tile files. They think a WASM adapter with smart caching could eventually close the gap.
  • PMTiles is already widely supported (a few): Another commenter points out that PMTiles has a GDAL driver, which suggests broader ecosystem adoption than the blog post implies.

Links from the comments

#maps #selfHosting #PMTiles #CDN #MapLibre #cloudStorage