@@ -529,6 +529,73 @@ describe('Geo metadata tests', async () => {
529
529
} ) ;
530
530
} ) ;
531
531
532
+ describe ( "GDAL_METADATA tests" , async ( ) => {
533
+ it ( 'should parse stats for specific sample' , async ( ) => {
534
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'abetow-ERD2018-EBIRD_SCIENCE-20191109-a5cf4cb2_hr_2018_abundance_median.tiff' ) ) ;
535
+ const image = await tiff . getImage ( ) ;
536
+ const metadata = await image . getGDALMetadata ( 10 ) ;
537
+ expect ( metadata ) . to . deep . equal ( {
538
+ STATISTICS_MAXIMUM : '7.2544522285461' ,
539
+ STATISTICS_MEAN : 'nan' ,
540
+ STATISTICS_MINIMUM : '0' ,
541
+ STATISTICS_STDDEV : 'nan'
542
+ } ) ;
543
+ } ) ;
544
+
545
+ it ( 'should parse stats for single-band GeoTIFF' , async ( ) => {
546
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'nt_20201024_f18_nrt_s.tif' ) ) ;
547
+ const image = await tiff . getImage ( ) ;
548
+ const metadata = await image . getGDALMetadata ( ) ;
549
+ expect ( metadata ) . to . deep . equal ( {
550
+ STATISTICS_MAXIMUM : '100' ,
551
+ STATISTICS_MEAN : '28.560288669249' ,
552
+ STATISTICS_MINIMUM : '0' ,
553
+ STATISTICS_STDDEV : '39.349526064368'
554
+ } ) ;
555
+ } ) ;
556
+
557
+ it ( 'should parse layer type' , async ( ) => {
558
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'eu_pasture.tiff' ) ) ;
559
+ const image = await tiff . getImage ( ) ;
560
+ const metadata = await image . getGDALMetadata ( ) ;
561
+ expect ( metadata ) . to . deep . equal ( {
562
+ LAYER_TYPE : 'athematic'
563
+ } ) ;
564
+ } ) ;
565
+
566
+ it ( 'should parse color interpretation' , async ( ) => {
567
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'utm.tif' ) ) ;
568
+ const image = await tiff . getImage ( ) ;
569
+ const metadata = await image . getGDALMetadata ( ) ;
570
+ expect ( metadata ) . to . deep . equal ( {
571
+ COLORINTERP : 'Palette'
572
+ } ) ;
573
+ } ) ;
574
+
575
+ it ( 'should parse stats for another single-band GeoTIFF' , async ( ) => {
576
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'vestfold.tif' ) ) ;
577
+ const image = await tiff . getImage ( ) ;
578
+ const metadata = await image . getGDALMetadata ( ) ;
579
+ expect ( metadata ) . to . deep . equal ( {
580
+ STATISTICS_MAXIMUM : '332.6073328654' ,
581
+ STATISTICS_MEAN : '83.638959236148' ,
582
+ STATISTICS_MINIMUM : '18.103807449341' ,
583
+ STATISTICS_STDDEV : '69.590554367352'
584
+ } ) ;
585
+ } ) ;
586
+
587
+ it ( 'should parse creation times' , async ( ) => {
588
+ const tiff = await GeoTIFF . fromSource ( createSource ( 'wind_direction.tif' ) ) ;
589
+ const image = await tiff . getImage ( ) ;
590
+ const metadata = await image . getGDALMetadata ( ) ;
591
+ expect ( metadata ) . to . deep . equal ( {
592
+ creationTime : '1497289465' ,
593
+ creationTimeString : '2017-06-12T17:44:25.466257Z' ,
594
+ name : 'Wind_Dir_SFC'
595
+ } ) ;
596
+ } ) ;
597
+ } ) ;
598
+
532
599
describe ( 'COG tests' , async ( ) => {
533
600
it ( 'should parse the header ghost area when present' , async ( ) => {
534
601
const tiff = await GeoTIFF . fromSource ( createSource ( 'cog.tiff' ) ) ;
0 commit comments