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

Design Proposal: Allow overzoom for sparse pyramids tiles #938

Open
etiennejourdier opened this issue Dec 9, 2024 · 0 comments
Open

Design Proposal: Allow overzoom for sparse pyramids tiles #938

etiennejourdier opened this issue Dec 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@etiennejourdier
Copy link

etiennejourdier commented Dec 9, 2024

Design Proposal: Allow overzoom for sparse pyramid tiles

Motivation: help deploy light pmtiles

Vector tiles are a great opportunity for developers to host their own tile server rather than relying on a third-party service. However a full planet pmtiles in OpenMapTiles schema is more than 70 Go, which is too much for small-scale web hosting.

Hopefully most maps do not require full detail of the whole planet, but the whole planet only up to an intermediate zoom (let's say z10) to get a nice map, then full details (let's say z11-z14) only in an area of interest (a city, a state, a country, ...).

It is possible in pmtiles to store such sparse pyramid tiles, so I was expecting this behavior:
Image

  • in the area of interest (right side): display the available z11-z14 tiles
  • in the rest of the world (left side): overzoom in the last available level (z10)

But the acual maplibre behavior is this one, with nothing visible in the rest of the world
Image

This behavior is perfectly normal once you have noticed that the tile server logically responds an empty tile, so maplibre logically displays a transparent tile.

This behaviour is perfect when 2 sources have been declared : you want the user to see the 2nd source below when the 1st one is not available. But it is not suited for 1 sparse pmtiles source for which the "show me what's below" behavior would be to display the last available level.

MapLibre is able to overzoom the last available level when it is the maxzoom level and also when the tile server responds with a 404 error instead of an empty tile (this is the way I used to prepare the 1st image above)

Proposed Change

I propose to allow the user to choose the expected behavior when the tile server responds an empty tile:

  • the default behavior would be the actual one: display nothing (for people with multiple sources)
  • a new available behavior would be to overzoom in the last available level (for people with 1 source), as is the case today when the tile server responds an error

This could be implemented in maplibre-style-spec during source definition, for example with a new parameter overzoomEmptyTile: true/false or emptyTileHandling: 'overzoom'/'transparent' that allows the user to choose the desired behavior

sources: {
  'openmaptiles': {
     type: 'vector',
     url: `pmtiles://${PMTILES_URL}`,
     overzoomEmptyTile: true,
  }
}

API Modifications

I don't know what to write in this section.

Migration Plan and Compatibility

I don't expect any compatibility issues, as the default behaviour would still be to display a transparent tile.

Rejected Alternatives

Several people (in this discussion on pmtiles repo and this one on maplibre GL JS repo) proposed to prepare 2 separate files and declare these as 2 sources. This solution is not suitable because:

  1. 2 sources make 2 calls whereas only 1 is used
  2. to apply the same style to both file sources, you have to duplicate the entire style definition. And for styles with a lot of layers (based on OpenMapTiles schema for example), it makes a lot of duplicated content.
  3. more problematic, since the z10 tile is overzoomed everywhere, you get in the area of interest a strange superposition of both sources:

Image Image

This proposal will allow a single-file solution that can be easily deployed by people with few map-coding skills, on small-scale servers.

@HarelM HarelM added the enhancement New feature or request label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants