Looking at tilesets
manby serve serves PMTiles archives, MBTiles databases and directories of tiles, with a map of them.
manby serve --open roads.pmtiles places.mbtilesThe map, at http://127.0.0.1:8080/, shows each layer of a tileset on a basemap, and the attributes of the features clicked. A tileset made again while it is served shows when the map reloads, so manby -f and the map make a quick loop. The map loads MapLibre GL JS and the basemap from the internet.
The hexagons of --h3 are colored by a field picked in the panel, point_count at first, with a scale for each resolution from the hexagons shown. With --h3-fade, the resolutions and the points fade from one to the next.
--portis 8080 unless given, or 0 for any free port.--hostis 127.0.0.1, so only this computer can reach the server.--host=0.0.0.0serves the local network too.--openopens the map in a browser.
It is a server for looking at tilesets, not for hosting them. A PMTiles archive on a bucket or a CDN needs no server.
In a map of one’s own
Section titled “In a map of one’s own”Each tileset’s TileJSON is at /{name}.json, its tiles at /{name}/{z}/{x}/{y}.mvt (.mlt for MapLibre Tiles), and a PMTiles archive is also served whole, at its file name, with range requests. Every response allows any origin.
map.addSource('roads', { type: 'vector', url: 'http://127.0.0.1:8080/roads.json' });From R
Section titled “From R”serve() shows the map in the viewer pane, or a browser, and gives the addresses.
server <- manby::serve("roads.pmtiles")server$tilejson[["roads"]]server$stop()With mapgl, the archive goes in as PMTiles.
mapgl::maplibre() |> mapgl::add_pmtiles_source(id = "roads", url = "http://127.0.0.1:8080/roads.pmtiles")From Python
Section titled “From Python”manby.serve() opens the map in a browser, or in a notebook shows it there.
server = manby.serve("roads.pmtiles")server.tilejson["roads"]server.stop()Tile sizes
Section titled “Tile sizes”manby stats reports how big a tileset’s tiles are at each zoom, as stored, and lists the largest. --layers also counts each layer’s features at each zoom, from every tile, which shows where dropping and coalescing took effect.
manby stats --layers --largest=3 states.pmtilesstates.pmtiles: PMTiles of MVT tiles, 76 tiles, 32,803 bytesz tiles total mean p50 p99 max0 1 1,365 1,365 1,365 1,365 1,3651 1 1,734 1,734 1,734 1,734 1,7342 2 2,529 1,264 1,221 1,308 1,3083 4 3,511 877 866 1,158 1,1584 6 4,037 672 588 1,233 1,2335 17 6,783 399 363 1,082 1,0826 45 12,844 285 256 596 596
z layer tiles features points lines polygons0 states 1 110 0 110 01 states 1 110 0 110 02 states 2 129 0 129 03 states 4 148 0 148 04 states 6 138 0 138 05 states 17 160 0 160 06 states 45 206 0 206 0
The 3 largest tiles:z x y bytes1 0 0 1,7340 0 0 1,3652 1 1 1,308It reads PMTiles archives, MBTiles databases and directories of tiles, an archive’s sizes from its directories alone. --json writes the report as JSON, --largest=N lists N tiles, and a run of identical tiles counts as that many tiles, as a map fetches them.
From R, tile_stats() gives the report as data frames, and from Python manby.stats() as a dict.
manby::tile_stats("roads.pmtiles", layers = TRUE)$layersmanby.stats("roads.pmtiles", layers=True)["zooms"]