Merge pull request #14064 from tschaub/geotiff-view
Avoid stuck maps when resolving views from a GeoTIFF
@@ -667,12 +667,11 @@ class GeoTIFFSource extends DataTile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const additionalBands = this.addAlpha_ ? 1 : 0;
|
let bandCount = this.addAlpha_ ? 1 : 0;
|
||||||
this.bandCount =
|
for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {
|
||||||
samplesPerPixel.reduce((accumulator, value) => {
|
bandCount += samplesPerPixel[sourceIndex];
|
||||||
accumulator += value;
|
}
|
||||||
return accumulator;
|
this.bandCount = bandCount;
|
||||||
}, 0) + additionalBands;
|
|
||||||
|
|
||||||
const tileGrid = new TileGrid({
|
const tileGrid = new TileGrid({
|
||||||
extent: extent,
|
extent: extent,
|
||||||
@@ -687,12 +686,19 @@ class GeoTIFFSource extends DataTile {
|
|||||||
|
|
||||||
this.setLoader(this.loadTile_.bind(this));
|
this.setLoader(this.loadTile_.bind(this));
|
||||||
this.setState('ready');
|
this.setState('ready');
|
||||||
|
|
||||||
|
let zoom = 0;
|
||||||
|
if (resolutions.length === 1) {
|
||||||
|
resolutions = [resolutions[0] * 2, resolutions[0]];
|
||||||
|
zoom = 1;
|
||||||
|
}
|
||||||
this.viewResolver({
|
this.viewResolver({
|
||||||
|
showFullExtent: true,
|
||||||
projection: this.projection,
|
projection: this.projection,
|
||||||
resolutions: resolutions,
|
resolutions: resolutions,
|
||||||
center: toUserCoordinate(getCenter(extent), this.projection),
|
center: toUserCoordinate(getCenter(extent), this.projection),
|
||||||
extent: toUserExtent(extent, this.projection),
|
extent: toUserExtent(extent, this.projection),
|
||||||
zoom: 0,
|
zoom: zoom,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ describe('ol/source/GeoTIFF', function () {
|
|||||||
expect(projection.getUnits()).to.be('degrees');
|
expect(projection.getUnits()).to.be('degrees');
|
||||||
expect(viewOptions.extent).to.eql([-180, -90, 180, 90]);
|
expect(viewOptions.extent).to.eql([-180, -90, 180, 90]);
|
||||||
expect(viewOptions.center).to.eql([0, 0]);
|
expect(viewOptions.center).to.eql([0, 0]);
|
||||||
expect(viewOptions.resolutions).to.eql([0.703125]);
|
expect(viewOptions.resolutions).to.eql([1.40625, 0.703125]);
|
||||||
|
expect(viewOptions.showFullExtent).to.be(true);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 85 KiB |