@@ -366,6 +366,7 @@ List CPL_read_gdal(CharacterVector fname, CharacterVector options, CharacterVect
366366 CharacterVector descriptions (bands.size ());
367367 NumericMatrix ranges (bands.size (), 4 );
368368 IntegerMatrix blocksizes (bands.size (), 2 );
369+ IntegerVector colorInterp (bands.size ());
369370 for (int i = 0 ; i < bands.size (); i++) {
370371 if ((poBand = poDataset->GetRasterBand (bands (i))) == NULL )
371372 stop (" trying to read a band that is not present" );
@@ -391,6 +392,7 @@ List CPL_read_gdal(CharacterVector fname, CharacterVector options, CharacterVect
391392 poBand->GetBlockSize (&nBlockXSize, &nBlockYSize);
392393 blocksizes (i, 0 ) = nBlockXSize;
393394 blocksizes (i, 1 ) = nBlockYSize;
395+ colorInterp (i) = (int ) poBand->GetColorInterpretation ();
394396 }
395397
396398 // get metadata items:
@@ -462,7 +464,8 @@ List CPL_read_gdal(CharacterVector fname, CharacterVector options, CharacterVect
462464 _[" blocksizes" ] = blocksizes,
463465 _[" descriptions" ] = descriptions,
464466 _[" default_geotransform" ] = default_geotransform,
465- _[" proxy" ] = LogicalVector::create (!read_data)
467+ _[" proxy" ] = LogicalVector::create (!read_data),
468+ _[" colorInterp" ] = colorInterp
466469 );
467470 if (read_data) {
468471 ReturnList.attr (" data" ) = read_gdal_data (poDataset, nodatavalue, nXOff, nYOff,
0 commit comments