PMTiles
PMTiles copied to clipboard
support tiles beyond z14 in leaf directories
Is this the same issue as with the maxzoom parameter being ignored for GL JS maps when using a serverless setup? Currently Maplibre keeps requesting tiles from the pmtiles source beyond the maxzoom set in the style when using a serverless source.
For GL JS styles it would appear that the maxzoom needs to be set to 12 for a serverless setup, not 14 as in the example styles available from the pmtiles download. However there are tiles beyond 12 which I can tell from comparing a serverless map to the theme examples.
- Are the tiles served from the theme example page tiled to a higher zoom than 14, or are these the same tiles output from the downloads site?
- If they are the same...any ideas as to why in GL nothing appears after zoom level 13?
@reyemtm did you download from https://protomaps.com/downloads/large_map ? if so it's possible your PMTiles archive only goes down to 12, because the total # of tiles in a single export is limited to 10,000. a Smaller area might get you down to 14.
Ok that explains it. I'll try downloading a smaller area. So if a larger area is needed that's when licensing comes in?
On Tue, Mar 29, 2022, 2:47 AM Brandon Liu @.***> wrote:
@reyemtm https://github.com/reyemtm did you download from https://protomaps.com/downloads/large_map ? if so it's possible your PMTiles archive only goes down to 12, because the total # of tiles in a single export is limited to 10,000. a Smaller area might get you down to 14.
— Reply to this email directly, view it on GitHub https://github.com/protomaps/PMTiles/issues/4#issuecomment-1081473478, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQ2HUIIWTDY3EIBPYQQRR3VCKRQFANCNFSM4YEN7YJQ . You are receiving this because you were mentioned.Message ID: @.***>
Confirmed downloading a smaller area fixed the issue.
Oh! I see, so tiles beyond z14 are not supported in single-file? See: https://tulsa-crash-map.netlify.app/#13/36.15138/-95.98636 vs https://tulsa-crash-map.netlify.app/#14/36.15138/-95.98636.
Any ideas on workarounds? I suppose a second layer with regular XYZ would do the trick...
Separately, how do zooms beyond 14 work on this map? Or am I missing something?
Note: I'm using the python bin for this. Also, it's possible I'm doing something wrong during the mbtiles step.
What source did you get the first one from? It looks like it only contains tiles down to z13, which might have been introduced as a limitation if you downloaded a "large map" (confusing right now, I know)
The client uses overzooming, so when you go beyond 14 in MapLibre, your data source is still the z14 tile, although your zoom-dependent styling can show different features at 15, 16, 17 etc.
Currently the implementations only support one leaf level, so up to z14. In practice, most vector tile applications get enough resolution with z14, but it's worth supporting z15 for the cases that do really need it as well as raster tiles.
Thank you for the reply! I've been obsessed with this awesome work for the past few days.
What source did you get the first one from? It looks like it only contains tiles down to z13, which might have been introduced as a limitation if you downloaded a "large map" (confusing right now, I know)
Ah, I see, okay. So, the basemap is a small area map extract. I see what you mean by the maxzoom in the source data.
However, I'm interested in why my red point data (which is generated from pmtiles-convert command), doesn't appear beyond zoom 13:

Apologies if I'm missing something entirely.
Further thinking: I believe maplibre-gl is not over-zooming past the specified maxzoom of this particular set of pmtiles for some reason.
I can confirm this when I view the mbtiles version of the dataset in mapbox-gl, where it does the overzooming beyond the maxzoom.
So it might be:
- maplibre-gl is not overzooming using the ProtocolCache from the pmtiles JavaScript library
- something is wrong with the way I've generated these particular pmtiles
- some combination of both
I'm not sure why it would be explanation 1) because maplibre-gl overzooms beyond the maxzoom with the basemap pmtiles just fine.
I'm going to try a few different things but any observations would help! Thank you! :)
(I realize this discovery moves it outside the intention of this particular issue).
OKAY I figured it out. It's because I needed to explicitly specify the maxzoom in my source configuration. I'm sure that's documented somewhere. Sorry, I really went down a rabbit hole there. I'm not sure how mbview works but I wonder if it infers the maxzoom from the metadata? Anyway, thanks for letting me bounce ideas here.
@allthesignals yeah, that makes sense. Ideally, the PMTiles maplibre adapter should read the metadata from the archive and then populate maxzoom correctly, but with the way addProtocol works right now I don't think that is straightforward to do.
Opened https://github.com/protomaps/PMTiles/issues/48
PMTiles are so cool! Thanks @bdon for all the work you put into this :)
I run into a similar issue with the map disappearing when going to zoom level 13 and more. I generated the tiles with planetiler in https://github.com/wipfli/swiss-map which creates a 239 MB mbtiles and a 329 MB pmtiles file. My workaround there was to limit to zoom 12 in the tiles:
"sources": {
"swissmap": {
"type": "vector",
"tiles": ["pmtiles://output.pmtiles/{z}/{x}/{y}"],
"maxzoom": 12
}
},
But then details will be missing from levels 13, 14.
Yeah, unfortunately there is no way through maplibre addProtocol to auto-detect the max zoom of the archive, you'll need to specify it in the style. However, it definitely should be the case that all the tiles in the source mbtiles end up in the pmtiles result, can you tell me what pmtiles-convert version you are using?
I used the command pmtiles-convert data/output.mbtiles output.pmtiles, here is the version:
➜ swiss-map git:(main) ✗ pip3 show pmtiles
Name: pmtiles
Version: 1.1.0
Summary: Library and utilities to write and read PMTiles files - cloud-optimized archives of map tiles.
Home-page: https://github.com/protomaps/pmtiles
Author: Brandon Liu
Author-email: [email protected]
License: BSD-3-Clause
Location: /home/wipfli/.local/lib/python3.8/site-packages
Requires:
Required-by:
You can download the mbtiles and pmtiles file here:
- https://github.com/wipfli/swiss-map/releases/download/v1.0.0/output.mbtiles
- https://github.com/wipfli/swiss-map/releases/download/v1.0.0/output.pmtiles
I installed v1.3.0 and the issue with the missing tiles is gone. Sorry for not checking earlier @bdon...
@wipfli ok, thanks for letting me know! btw, for the v3 mbtiles conversion tool I'm considering releasing that as a standalone binary (go version) instead of getting pmtiles-convert through python, is that better/worse for you in any way?
Also long as it is easy to get and run on ubuntu, I think a standalone binary is fine too...