From 9b0e473d304ec601605016f649028a2c49437743 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Wed, 26 Apr 2023 19:54:24 +0200 Subject: [PATCH] checking of tile types in openlayers [#3] --- js/examples/openlayers.html | 4 +++- js/examples/openlayers_raster.html | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/examples/openlayers.html b/js/examples/openlayers.html index e26ff59..9fa7f29 100644 --- a/js/examples/openlayers.html +++ b/js/examples/openlayers.html @@ -54,7 +54,9 @@ this._p = new pmtiles.PMTiles(options.url); this._p.getHeader().then(h => { - // TODO: set extent based on header + if (h.tileType !== pmtiles.TileType.Mvt) { + console.warn("Warning: pmtiles tile type is not mvt"); + } this.tileGrid.minZoom = h.minZoom; this.tileGrid.maxZoom = h.maxZoom; this.setTileLoadFunction(this.tileLoadFunction); diff --git a/js/examples/openlayers_raster.html b/js/examples/openlayers_raster.html index 77964f3..0fc2631 100644 --- a/js/examples/openlayers_raster.html +++ b/js/examples/openlayers_raster.html @@ -34,7 +34,9 @@ const p = new pmtiles.PMTiles(options.url); p.getHeader().then(h => { - // TODO: set extent based on header + if (h.tileType !== pmtiles.TileType.Jpeg && h.tileType !== pmtiles.TileType.Png && h.tileType !== pmtiles.TileType.Webp) { + console.warn("Warning: pmtiles tile type is not jpeg, png, or webp"); + } this.tileGrid.minZoom = h.minZoom; this.tileGrid.maxZoom = h.maxZoom; this.setLoader(async (z,x,y) => {