Skip to content

Allow a 'sparse' option per data source #1558

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

acalcutt
Copy link
Collaborator

@acalcutt acalcutt commented May 13, 2025

This PR adds a 'sparse' option to the data source, which can be defined like this in the config file

      "Europe_JAXA_SonnyDTM_Italy_France_Switzerland_Merged_Sparse":{
         "mbtiles":"Europe_JAXA_z0-12_SonnyDTM_z0-Z13_Italy_z0-Z14_France_z0-Z15_Switzerland_z0-Z16_Merged_Sparse_cubic.mbtiles",
         "sparse":true
      },

When the sparse options is 'true' it changes the error code reported by tileserver-gl when a tile does not exist from a 204 error, which maplibre interprets as no content, to a 410 (gone) error code. The 410 error code allows maplibre to try an fetch tiles from a lower zoom level if the requested tile does not exists instead of loading a blank image like it does with a 204 error.

For the maplibre-native rasters it also does something similar where it sends a empty callback instead of a callback with empty data

This allows tileserver-gl to work with a variable depth sparse tile data source like
https://techidiots.net/downloads/open-base-map-torrents/mbtiles/merged-terrainrgb

The 410 error code was used based on discussion in maplibre/maplibre-gl-js#5692

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant