Avoid stuck maps when resolving views from a GeoTIFF

This commit is contained in:
Tim Schaub
2022-08-28 10:17:26 -05:00
parent 1dc8a18362
commit 02cf27149a
7 changed files with 15 additions and 8 deletions

View File

@@ -667,12 +667,11 @@ class GeoTIFFSource extends DataTile {
}
}
const additionalBands = this.addAlpha_ ? 1 : 0;
this.bandCount =
samplesPerPixel.reduce((accumulator, value) => {
accumulator += value;
return accumulator;
}, 0) + additionalBands;
let bandCount = this.addAlpha_ ? 1 : 0;
for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {
bandCount += samplesPerPixel[sourceIndex];
}
this.bandCount = bandCount;
const tileGrid = new TileGrid({
extent: extent,
@@ -687,12 +686,19 @@ class GeoTIFFSource extends DataTile {
this.setLoader(this.loadTile_.bind(this));
this.setState('ready');
let zoom = 0;
if (resolutions.length === 1) {
resolutions = [resolutions[0] * 2, resolutions[0]];
zoom = 1;
}
this.viewResolver({
showFullExtent: true,
projection: this.projection,
resolutions: resolutions,
center: toUserCoordinate(getCenter(extent), this.projection),
extent: toUserExtent(extent, this.projection),
zoom: 0,
zoom: zoom,
});
}