Skip to content

Commit

Permalink
fix(lambda-tiler): correct mapping of high zoom levels (#1492)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha authored Mar 11, 2021
1 parent d27d9c5 commit 7e98e63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/lambda-tiler/src/__test__/tile.set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ o.spec('tile.set', () => {
}
});

o('should match zoom levels outside of the range of the target z', () => {
const ts = new TileSet('Nztm2000Quad', Nztm2000QuadTms);
o(ts.getDefaultZoomLevel(22)).equals(16);
o(ts.getDefaultZoomLevel(21)).equals(16);
o(ts.getDefaultZoomLevel(20)).equals(16);
});

o('should match the zoom levels from nztm2000 when using nztm2000quad', () => {
const ts = new TileSet('Nztm2000Quad', Nztm2000QuadTms);
o(ts.getDefaultZoomLevel(13)).equals(11);
Expand Down
2 changes: 1 addition & 1 deletion packages/lambda-tiler/src/tile.set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class TileSet {
const defaultMatrix = TileMatrixSets.get(this.tileMatrix.projection);

if (defaultMatrix.identifier === this.tileMatrix.identifier) return z;
if (z > defaultMatrix.maxZoom) return z;
if (z >= this.tileMatrix.maxZoom) z = this.tileMatrix.maxZoom;

return defaultMatrix.findBestZoom(this.tileMatrix.zooms[z].scaleDenominator);
}
Expand Down

0 comments on commit 7e98e63

Please sign in to comment.