
A walking map changes when you release a new edition, but its tiles stay the same between editions. That makes it a good candidate for PMTiles. Put one archive in object storage and let the browser fetch the pieces it needs as the visitor moves around. The deployment test is simple: can a browser on your map’s website draw a known tile without fetching the whole archive?
A PMTiles archive contains already-built tiles and a directory that tells a reader where to find them. The viewer uses the zoom level and tile coordinates to look up an offset and length. It then sends an HTTP Range request for those bytes. A static archive suits a published map edition. If every visitor needs different data or a live edit must appear immediately, account for the work of rebuilding and distributing the archive. The PMTiles format overview describes the read-only model.
We built a four-tile raster map with the Python PMTiles writer 3.8.1. Each tile is a 256-pixel square of synthetic contour lines. We kept the original PNG for zoom 1, x 1, y 0 as the reference. You can use the same method with a tile you recognize from your own map.
Pick an object key that identifies the edition, such as maps/contours-v1.pmtiles. When the map changes, upload the next edition under a new key and update the viewer URL. That keeps a reader with an old directory from asking for offsets in a different file.
For an S3-compatible provider, set S3_ENDPOINT to the storage API endpoint and BUCKET to your bucket name. Use your normal upload credentials in the shell. Give the viewer a readable HTTPS object URL, or a signed read URL valid for the intended session. Keep the upload credentials on the publishing side.
aws --endpoint-url "$S3_ENDPOINT" s3 cp contours-v1.pmtiles \
"s3://$BUCKET/maps/contours-v1.pmtiles" \
--content-type application/octet-stream
Set MAP_URL to the address the viewer will use, including the CDN if you have one. Run this probe in a shell. It requests the 127-byte header of a version 3 archive.
curl --silent --show-error --dump-header - \
--range 0-126 --output header.bin "$MAP_URL"
wc -c < header.bin
Look for 206 Partial Content, a Content-Range beginning with bytes 0-126/, and a body of 127 bytes. Our complete response range was bytes 0-126/68043. A successful full-file download or an Accept-Ranges header alone cannot establish that the delivery path honored the request.
A command-line client can read a response that browser JavaScript is forbidden to access. If the map page and archive have different origins, configure the bucket or CDN to allow the page’s origin. Our local test allowed GET and HEAD, allowed the request headers Range and If-Match, and exposed ETag, Content-Range and Accept-Ranges. The browser could read the range and ETag. Access to the object itself is a separate permission. See the Protomaps storage settings and the Hivenet guide to S3 CORS for configuration examples.
With the PMTiles browser reader loaded, mapUrl set to the object URL and canvas set to a 256-by-256 canvas, this draws the reference tile. The PNG decoding step applies to a raster archive. For an interactive map, connect the archive to your renderer and choose a layer appropriate for the tile type. Protomaps provides a MapLibre integration guide.
const archive = new pmtiles.PMTiles(mapUrl);
const tile = await archive.getZxy(1, 1, 0);
if (!tile) throw new Error("Tile 1/1/0 is missing");
const bitmap = await createImageBitmap(
new Blob([tile.data], { type: "image/png" })
);
canvas.getContext("2d").drawImage(bitmap, 0, 0);
Chrome loaded the viewer and storage endpoint from separate local origins. For a cold lookup, the JavaScript reader (4.5.0) made two GET requests to the 68,043-byte archive:
0-16383 and received 16,384 bytes with status 206.50928-68042 and received 17,115 bytes, also with status 206. The PNG decoded, drew on the canvas and matched the original file’s SHA-256 digest.Those two response bodies totaled 33,499 bytes. The separate 127-byte diagnostic probe is excluded. When we made the endpoint ignore the range, it responded with status 200 and the size of the entire archive. This reader rejected the response before it drew the tile. If your command-line probe also returns 200, inspect range handling at the bucket and CDN. If the probe passes but the browser reports a cross-origin error, inspect the allowed origin and response headers on that same URL.
We used a local S3 emulator. To evaluate Object Storage with Hivenet for your map, repeat the check against your intended delivery URL. Then pan and zoom through a typical route with a cold cache and again with a warm one. Record request count, transferred bytes and time to the first useful view. Two reads for one tile tell you whether that lookup worked. A representative session gives you the numbers to estimate request and transfer costs.
Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.