@@ -558,8 +558,8 @@ describe('GDAL_METADATA tests', async () => {
558
558
it ( 'should parse stats for single-band GeoTIFF' , async ( ) => {
559
559
const tiff = await GeoTIFF . fromSource ( createSource ( 'nt_20201024_f18_nrt_s.tif' ) ) ;
560
560
const image = await tiff . getImage ( ) ;
561
- const metadata = await image . getGDALMetadata ( ) ;
562
- expect ( metadata ) . to . deep . equal ( {
561
+ expect ( await image . getGDALMetadata ( ) , { } ) ; // no top-level-stats
562
+ expect ( await image . getGDALMetadata ( 0 ) ) . to . deep . equal ( {
563
563
STATISTICS_MAXIMUM : '100' ,
564
564
STATISTICS_MEAN : '28.560288669249' ,
565
565
STATISTICS_MINIMUM : '0' ,
@@ -570,7 +570,7 @@ describe('GDAL_METADATA tests', async () => {
570
570
it ( 'should parse layer type' , async ( ) => {
571
571
const tiff = await GeoTIFF . fromSource ( createSource ( 'eu_pasture.tiff' ) ) ;
572
572
const image = await tiff . getImage ( ) ;
573
- const metadata = await image . getGDALMetadata ( ) ;
573
+ const metadata = await image . getGDALMetadata ( 0 ) ;
574
574
expect ( metadata ) . to . deep . equal ( {
575
575
LAYER_TYPE : 'athematic' ,
576
576
} ) ;
@@ -579,7 +579,7 @@ describe('GDAL_METADATA tests', async () => {
579
579
it ( 'should parse color interpretation' , async ( ) => {
580
580
const tiff = await GeoTIFF . fromSource ( createSource ( 'utm.tif' ) ) ;
581
581
const image = await tiff . getImage ( ) ;
582
- const metadata = await image . getGDALMetadata ( ) ;
582
+ const metadata = await image . getGDALMetadata ( 0 ) ;
583
583
expect ( metadata ) . to . deep . equal ( {
584
584
COLORINTERP : 'Palette' ,
585
585
} ) ;
@@ -588,7 +588,7 @@ describe('GDAL_METADATA tests', async () => {
588
588
it ( 'should parse stats for another single-band GeoTIFF' , async ( ) => {
589
589
const tiff = await GeoTIFF . fromSource ( createSource ( 'vestfold.tif' ) ) ;
590
590
const image = await tiff . getImage ( ) ;
591
- const metadata = await image . getGDALMetadata ( ) ;
591
+ const metadata = await image . getGDALMetadata ( 0 ) ;
592
592
expect ( metadata ) . to . deep . equal ( {
593
593
STATISTICS_MAXIMUM : '332.6073328654' ,
594
594
STATISTICS_MEAN : '83.638959236148' ,
@@ -600,13 +600,22 @@ describe('GDAL_METADATA tests', async () => {
600
600
it ( 'should parse creation times' , async ( ) => {
601
601
const tiff = await GeoTIFF . fromSource ( createSource ( 'wind_direction.tif' ) ) ;
602
602
const image = await tiff . getImage ( ) ;
603
- const metadata = await image . getGDALMetadata ( ) ;
603
+ const metadata = await image . getGDALMetadata ( 0 ) ;
604
604
expect ( metadata ) . to . deep . equal ( {
605
605
creationTime : '1497289465' ,
606
606
creationTimeString : '2017-06-12T17:44:25.466257Z' ,
607
607
name : 'Wind_Dir_SFC' ,
608
608
} ) ;
609
609
} ) ;
610
+
611
+ it ( 'should parse top-level metadata when no sample is specified' , async ( ) => {
612
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'wind_direction.tif' ) ) ;
613
+ const image = await tiff . getImage ( ) ;
614
+ const metadata = await image . getGDALMetadata ( ) ;
615
+ expect ( metadata ) . to . deep . equal ( {
616
+ DATUM : 'WGS84' ,
617
+ } ) ;
618
+ } ) ;
610
619
} ) ;
611
620
612
621
describe ( 'COG tests' , async ( ) => {
0 commit comments