hn.today

Protomaps: Self-hosting map tiles has gotten cheap and easy

bruceroettgers.eu444 points78 comments
Screenshot of Protomaps: Self-hosting map tiles has gotten cheap and easy

The piece explains how PMTiles, part of the Protomaps ecosystem, makes it practical to host map tiles yourself rather than depend on commercial APIs that can become costly when an app attracts many users. A PMTiles map is stored as one file and served through HTTP Range requests, so clients fetch only the portions they need. Developers can download a ready-made global map or use the command-line tools to extract a smaller region or selected zoom levels. CDNs that cache range requests can serve the file directly; others may need an edge function to translate standard tile URLs.

Bunny.net is presented as a low-cost option because it supports range requests and offers storage and CDN delivery. The guide estimates that storing a 139 GB world map with broad replication costs about $5 per month, while a typical session exploring Europe and a city might transfer around 5 MB, or roughly $0.00005 in bandwidth - potentially far cheaper per visit than Mapbox, though usage varies. Practical setup advice includes uploading through S3-compatible storage with rclone, enabling large-object caching, restricting permitted referrers, and setting limits to discourage full-file downloads or excessive traffic. Once deployed, the tiles can be used in a website with MapLibre GL by installing the PMTiles package and configuring its protocol and a map style.

Read on bruceroettgers.eu78 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.