Skip to content

Commit

Permalink
create customizable zoomRange for loading imagery with a small max zo…
Browse files Browse the repository at this point in the history
…om level
  • Loading branch information
emersonveenstra authored and bhousel committed Aug 1, 2024
1 parent b381611 commit 50fd6b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/core/lib/ImagerySource.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class ImagerySource {
this.tileSize = src.tileSize || 256;
this.type = src.type;
this.zoomExtent = src.zoomExtent || [0, 22];
this.zoomRange = src.zoomRange || 5;

this.isBlocked = false;
this.offset = [0, 0];
Expand Down
2 changes: 1 addition & 1 deletion modules/pixi/PixiLayerBackgroundTiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class PixiLayerBackgroundTiles extends AbstractLayer {
// including any zoomed out tiles if this field contains any holes
const needTiles = new Map(); // Map(tileID -> tile)
const maxZoom = Math.ceil(z); // the zoom we want (round up for sharper imagery)
const minZoom = Math.max(0, maxZoom - 5); // the mininimum zoom we'll accept
const minZoom = Math.max(0, maxZoom - source.zoomRange); // the mininimum zoom we'll accept

let covered = false;
for (let tryZoom = maxZoom; !covered && tryZoom >= minZoom; tryZoom--) {
Expand Down
4 changes: 4 additions & 0 deletions scripts/update_imagery.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ for (const [sourceID, source] of sources) {
];
}

if (source.zoomRange) {
item.zoomRange = source.zoomRange;
}

if (extent.polygon) {
item.polygon = extent.polygon;
} else if (extent.bbox) {
Expand Down

0 comments on commit 50fd6b9

Please sign in to comment.