You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a COG has per dataset masks the masks can be read as overviews incorrectly.
To Reproduce
Provide as able:
Use the COG in the attached zip file
Run the following code (create a rastersource, iterate over overviews to get band counts)
import geotrellis.raster.geotiff.GeoTiffRasterSource
val s = "<path to attached tiff>"
GeoTiffRasterSource(s).tiff.overviews.map(_.bandCount)
On my local machine this yielded the following:
scala> val s = "/mnt/c/Users/chris/projects/imagery/per-dataset-mask.tif"
s: String = /mnt/c/Users/chris/projects/imagery/per-dataset-mask.tif
scala> val rasterSource = GeoTiffRasterSource(s)
rasterSource: geotrellis.raster.geotiff.GeoTiffRasterSource = GeoTiffRasterSource(/mnt/c/Users/chris/projects/imagery/per-dataset-mask.tif)
scala> rasterSource.tiff.overviews.map(_.bandCount)
res6: List[Int] = List(1, 3, 1)
Showing 3 overviews with 1, 3, and 1 bands respectively.
Meanwhile gdalinfo shows there is only a single overview:
root@764d7618786e:/tmp# gdalinfo per-dataset-mask.tif
Driver: GTiff/GeoTIFF
Files: per-dataset-mask.tif
Size is 1024, 1024
Coordinate System is:
<ommitted>
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
Overviews: 512x512
Mask Flags: PER_DATASET
Overviews of mask band: 512x512
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
Overviews: 512x512
Mask Flags: PER_DATASET
Overviews of mask band: 512x512
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
Overviews: 512x512
Mask Flags: PER_DATASET
Overviews of mask band: 512x512
Expected behavior
Only overviews are returned, masks are not returned
Additional context
Based on the documentation in gdal I suspect the raster masks are getting read as overviews because they are also put in the IFD, but do not represent lower resolution images.
The text was updated successfully, but these errors were encountered:
Describe the bug
When a COG has per dataset masks the masks can be read as overviews incorrectly.
To Reproduce
Provide as able:
On my local machine this yielded the following:
Showing 3 overviews with 1, 3, and 1 bands respectively.
Meanwhile
gdalinfo
shows there is only a single overview:Expected behavior
Only overviews are returned, masks are not returned
Additional context
Based on the documentation in
gdal
I suspect the raster masks are getting read as overviews because they are also put in the IFD, but do not represent lower resolution images.The text was updated successfully, but these errors were encountered: