PMTiles Swarm


PMTiles Swarm is a BitTorrent client and server that knows what a map is. Large PMTiles archives are expensive to host and slow to download from a single server. Swarm shares that load across everyone who has a copy, and it keeps track of what each archive actually contains.

Project Link: github.com/TechIdiots-LLC/pmtiles-swarm | GitLab

Key Features

Torrents for map archives Create torrents from .pmtiles files, join existing torrents or magnet links, and import new builds automatically from watched folders or dated web locations.

RSS feeds for distribution Each node publishes its maps as RSS feeds. Other swarm instances follow them to pick up new maps, and any client can subscribe to download new builds automatically. The feeds are plain RSS 2.0 with torrent enclosures, so qBittorrent's built-in RSS auto-downloader works with them. Each item also carries the map's format, zoom range, bounds and tile count, so a subscriber can decide whether a multi-gigabyte download is worth starting.

Mirror or cache other nodes Follow another node's feed to mirror everything it publishes, or to cache only what you use.

Use the engine you already have Seeding is delegated to libtorrent, your existing qBittorrent, or an embedded WebTorrent client, so one node can serve a multi-terabyte library and browser peers over WebRTC at the same time.

Tile endpoints on demand, even for unfinished maps Every PMTiles archive is also a tile endpoint, with TileJSON and z/x/y URLs a map can point straight at, so no separate tile server is needed. This works while an archive is still downloading: a node holding almost none of a huge archive can still answer for any tile in it, fetching only the pieces that tile lives in. In cache mode a node joins the swarm without downloading the whole map up front and serves tiles on demand, so you can host a very large map without the disk space for all of it. (MBTiles archives are served once the download is complete.)

Web console A torrent-client-style web UI shows progress, peers, ratios and swarm traffic, and handles adding archives, watched folders, remote nodes and settings.

Quick Start

npm install
node src/index.js --config swarm.config.json
# then open http://localhost:8090

A Docker image is available as techidiotsllc/pmtiles-swarm. The repository's documentation covers engines, publishing, subscribing, security, running as a service, and reverse proxy setup.

Advertisement