Support a normalize option on the GeoTIFF source

This commit is contained in:
Tim Schaub
2021-09-29 10:25:22 -06:00
parent 5f118b0244
commit d7b0191c78
2 changed files with 72 additions and 12 deletions

View File

@@ -14,6 +14,7 @@ describe('ol/source/GeoTIFF', function () {
});
expect(source.readMethod_).to.be('readRasters');
});
it('configures readMethod_ to read RGB', function () {
const source = new GeoTIFFSource({
convertToRGB: true,
@@ -25,6 +26,37 @@ describe('ol/source/GeoTIFF', function () {
});
expect(source.readMethod_).to.be('readRGB');
});
it('generates Float32Array data if normalize is set to false', (done) => {
const source = new GeoTIFFSource({
normalize: false,
sources: [{url: 'spec/ol/source/images/0-0-0.tif'}],
});
source.on('change', () => {
const tile = source.getTile(0, 0, 0);
source.on('tileloadend', () => {
expect(tile.getState()).to.be(TileState.LOADED);
expect(tile.getData()).to.be.a(Float32Array);
done();
});
tile.load();
});
});
it('generates Uint8Array data if normalize is not set to false', (done) => {
const source = new GeoTIFFSource({
sources: [{url: 'spec/ol/source/images/0-0-0.tif'}],
});
source.on('change', () => {
const tile = source.getTile(0, 0, 0);
source.on('tileloadend', () => {
expect(tile.getState()).to.be(TileState.LOADED);
expect(tile.getData()).to.be.a(Uint8Array);
done();
});
tile.load();
});
});
});
describe('loading', function () {