diff --git a/examples/js/plugins/COGParser.js b/examples/js/plugins/COGParser.js index a36eebeb79..5d72b48abb 100644 --- a/examples/js/plugins/COGParser.js +++ b/examples/js/plugins/COGParser.js @@ -107,6 +107,7 @@ async function readRGB(source, level, viewport) { pool: source.pool, width: source.tileWidth, height: source.tileHeight, + resampleMethod: source.resampleMethod, enableAlpha: true, interleave: true, }); diff --git a/examples/js/plugins/COGSource.js b/examples/js/plugins/COGSource.js index 909d6dd0fe..33e21f44bc 100644 --- a/examples/js/plugins/COGSource.js +++ b/examples/js/plugins/COGSource.js @@ -15,6 +15,9 @@ * @property {string} url - The URL of the COG. * @property {GeoTIFF.Pool} pool - Pool use to decode GeoTiff. * @property {number} defaultAlpha - Alpha byte value used if no alpha is present in COG. Default value is 255. + * @property {number} tileWidth - Tile width in pixels. Default value use 'geotiff.getTileWidth()'. + * @property {number} tileHeight - Tile height in pixels. Default value use 'geotiff.getTileHeight()'. + * @property {number} resampleMethod - The desired resampling method. Default is 'nearest'. * * @example * // Create the source @@ -59,9 +62,9 @@ class COGSource extends itowns.Source { this.firstImage = await geotiff.getImage(); this.origin = this.firstImage.getOrigin(); this.dataType = this.selectDataType(this.firstImage.getSampleFormat(), this.firstImage.getBitsPerSample()); - - this.tileWidth = this.firstImage.getTileWidth(); - this.tileHeight = this.firstImage.getTileHeight(); + this.tileWidth = source.tileWidth || this.firstImage.getTileWidth(); + this.tileHeight = source.tileHeight || this.firstImage.getTileHeight(); + this.resampleMethod = source.resampleMethod || 'nearest'; // Compute extent const [minX, minY, maxX, maxY] = this.firstImage.getBoundingBox();