Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support tiles beyond z14 in leaf directories #4

Closed
bdon opened this issue Feb 24, 2021 · 18 comments
Closed

support tiles beyond z14 in leaf directories #4

bdon opened this issue Feb 24, 2021 · 18 comments
Assignees
Labels
v3 spec version 3 design

Comments

@bdon
Copy link
Member

bdon commented Feb 24, 2021

No description provided.

@bdon bdon self-assigned this Feb 24, 2021
@reyemtm
Copy link

reyemtm commented Mar 24, 2022

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.

@reyemtm
Copy link

reyemtm commented Mar 24, 2022

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?

@bdon
Copy link
Member Author

bdon commented Mar 29, 2022

@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.

@reyemtm
Copy link

reyemtm commented Mar 29, 2022 via email

@reyemtm
Copy link

reyemtm commented Apr 6, 2022

Confirmed downloading a smaller area fixed the issue.

@allthesignals
Copy link

allthesignals commented Jun 10, 2022

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.

@bdon
Copy link
Member Author

bdon commented Jun 10, 2022

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.

@allthesignals
Copy link

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:
image
image

Apologies if I'm missing something entirely.

@allthesignals
Copy link

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:

  1. maplibre-gl is not overzooming using the ProtocolCache from the pmtiles JavaScript library
  2. something is wrong with the way I've generated these particular pmtiles
  3. 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).

@allthesignals
Copy link

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.

@bdon
Copy link
Member Author

bdon commented Jun 12, 2022

@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.

@bdon
Copy link
Member Author

bdon commented Jun 12, 2022

Opened #48

@wipfli
Copy link
Contributor

wipfli commented Jul 3, 2022

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.

@bdon
Copy link
Member Author

bdon commented Jul 4, 2022

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?

@wipfli
Copy link
Contributor

wipfli commented Jul 4, 2022

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: brandon@protomaps.com
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:

@wipfli
Copy link
Contributor

wipfli commented Jul 4, 2022

I installed v1.3.0 and the issue with the missing tiles is gone. Sorry for not checking earlier @bdon...

@bdon
Copy link
Member Author

bdon commented Jul 6, 2022

@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?

@wipfli
Copy link
Contributor

wipfli commented Jul 6, 2022

Also long as it is easy to get and run on ubuntu, I think a standalone binary is fine too...

@bdon bdon added the v3 spec version 3 design label Aug 10, 2022
bdon added a commit that referenced this issue Sep 27, 2022
The v3 module is not exported yet; specifics of header design subject to change.
@bdon bdon closed this as completed Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 spec version 3 design
Projects
None yet
Development

No branches or pull requests

4 participants