Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update empty-tiles.md with maplibregl support for empty tile co…
…ntent (#3396) Since Maplibre GL v4.0.0 an empty response with 200 or 204 will be treated as a transparent tile ### Motivation update to documentation reflecting current support by maplibregl ### Modifications update to documentation ### Verification I tested this locally with ```bash nc -c 'echo -ne "HTTP/1.0 204 No Content\r\nAccess-Control-Allow-Origin: *\r\n\r\n";' -l -p 8080 -k # and nc -c 'echo -ne "HTTP/1.0 200 OK\r\nContent-Length: 0\r\nAccess-Control-Allow-Origin: *\r\n\r\n";' -l -p 8080 -k ``` with the following ```js const map = new maplibregl.Map({ container: 'map', style: { 'version': 8, 'sources': { 'osm': { 'type': 'raster', 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ], 'tileSize': 256 }, '204': { 'type': 'raster', 'tiles': [ 'http://localhost:8080/{z}/{x}/{y}' ], 'tileSize': 256 } }, 'layers': [ // bottom, drawn first { 'id': 'osm', 'type': 'raster', 'source': 'osm', 'minzoom': 0, 'maxzoom': 22 }, { 'id': '204', 'type': 'raster', 'source': '204', 'minzoom': 0, 'maxzoom': 22 } // top, drawn last ] }, center: [0, 0], zoom: 1 }); ``` no errors reported in the console and tiles from the 204 layer are drawn transparently. I also reviewed the maplibre-gl-js source code, there are two code paths for loading tiles depending on how much the cache should be respected and both code paths seem to support a 200/204 response with no content. Co-authored-by: Blayne Chard <bchard@linz.govt.nz>
- Loading branch information