From 6d50535f80c96fb482ad7c29c3fd7f43bbed987c Mon Sep 17 00:00:00 2001 From: Kata Martin Date: Thu, 9 Dec 2021 16:54:10 -0800 Subject: [PATCH] Inspect datasets array instead of using kwargs --- src/utils.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/utils.js b/src/utils.js index faf51ae..1bc5d19 100644 --- a/src/utils.js +++ b/src/utils.js @@ -249,12 +249,10 @@ export const getTilesOfRegion = (region, level) => { } export const getPyramidMetadata = (metadata) => { - const kwargs = metadata.metadata['.zattrs'].multiscales[0].metadata.kwargs - const maxZoom = kwargs.levels - 1 - const levels = Array(maxZoom + 1) - .fill() - .map((_, i) => i) - const tileSize = kwargs.pixels_per_tile + const datasets = metadata.metadata['.zattrs'].multiscales[0].datasets + const levels = datasets.map((dataset) => Number(dataset.path)) + const maxZoom = Math.max(...levels) + const tileSize = datasets[0].pixels_per_tile return { levels, maxZoom, tileSize } }