Skip to content

Commit

Permalink
Inspect datasets array instead of using kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
katamartin committed Dec 10, 2021
1 parent 98251fd commit 6d50535
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down

0 comments on commit 6d50535

Please sign in to comment.