Allow a 'sparse' option per data source #1558
Open
+49
−40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a 'sparse' option to the data source, which can be defined like this in the config file
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