@@ -5,12 +5,12 @@ const { getStats } = require('../index.js');
5
5
6
6
const SECONDS_TO_MILLISECONDS = 1000 ;
7
7
8
- async function getStatsFromFilepath ( filepath ) {
8
+ async function getStatsFromFilepath ( filepath , debug = false ) {
9
9
const data = readFileSync ( filepath ) ;
10
10
const arrayBuffer = data . buffer . slice ( data . byteOffset , data . byteOffset + data . byteLength ) ;
11
11
const geotiff = await fromArrayBuffer ( arrayBuffer ) ;
12
12
const image = await geotiff . getImage ( ) ;
13
- return await getStats ( image , true ) ;
13
+ return await getStats ( image , debug ) ;
14
14
}
15
15
16
16
describe ( "GeoTIFF.js Test Data" , function ( ) {
@@ -29,6 +29,15 @@ describe("GeoTIFF.js Test Data", function() {
29
29
const { bands } = await getStatsFromFilepath ( './test/data/GeogToWGS84GeoKey5.tif' ) ;
30
30
expect ( bands [ 0 ] . min ) . to . equal ( 0 ) ;
31
31
expect ( bands [ 0 ] . max ) . to . equal ( 2 ) ;
32
+ } ) ;
33
+ it ( 'RGB GeoTIFF that has GDAL Metadata without Stats' , async function ( ) {
34
+ const { bands } = await getStatsFromFilepath ( './test/data/rgb_raster.tif' ) ;
35
+ expect ( bands [ 0 ] . min ) . to . equal ( 0 ) ;
36
+ expect ( bands [ 0 ] . max ) . to . equal ( 182 ) ;
37
+ expect ( bands [ 1 ] . min ) . to . equal ( 0 ) ;
38
+ expect ( bands [ 1 ] . max ) . to . equal ( 255 ) ;
39
+ expect ( bands [ 2 ] . min ) . to . equal ( 0 ) ;
40
+ expect ( bands [ 2 ] . max ) . to . equal ( 255 ) ;
32
41
} )
33
42
} ) ;
34
43
0 commit comments