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
BACKGROUND
I'm building a global elevation dataset consisting of BIL files generated from source GeoTIF files. This task is accomplished by way of a custom tool that walks a grid of the Earth, each cell being 150x150 pixels, and invokes gdalwarp to operate on each cell region. Using gdalinfo to query the generated BILs, I receive "Invalid band count" on a small percentage of BIL files. These should contain exactly one band (elevation values), but the error identifies band count from thousands to millions, depending upon the specified BIL. Manually sampling parts of the BIL file yielded the values that I expected, so the data itself appears correct.
REPRODUCE
One such case occurs after running the following gdalwarp command against the attached GeoTIF file to generate a BIL of a specified sub-region.
-> gdalwarp -overwrite -q -of ENVI -r bilinear -co INTERLEAVE=BIL -multi -te 68.74580536912751 24.995805369127517 70.00419463087249 26.254194630872483 -dstnodata -9999.0 -ot Int16 -ts 150 150 23N068E_20101117_gmted.tif output.bil -> gdalinfo output.bil ERROR 1: Invalid band count : 2621482. Maximum allowed currently is 65536. Define GDAL_MAX_BAND_COUNT to a higher level if it is a legitimate number. gdalinfo failed - unable to open 'output.bil'.
WORKAROUND
Doing any of the following works around the problem in most cases, with gdalinfo successfully printing the correct metrics for output.bil:
Setting GDAL_MAX_BAND_COUNT to well above the reported invalid band count, as suggested in the reported error.
Re-run gdalwarp with Int32 in place of Int16 for -ot parameter (both source and target tiles are Int16, so not sure why this helps).
Re-run gdalwarp with a slight change to the extent (ex: change 2nd decimal place of xMax (26.254194630872483) from 5 to 6).
BACKGROUND
I'm building a global elevation dataset consisting of BIL files generated from source GeoTIF files. This task is accomplished by way of a custom tool that walks a grid of the Earth, each cell being 150x150 pixels, and invokes gdalwarp to operate on each cell region. Using gdalinfo to query the generated BILs, I receive "Invalid band count" on a small percentage of BIL files. These should contain exactly one band (elevation values), but the error identifies band count from thousands to millions, depending upon the specified BIL. Manually sampling parts of the BIL file yielded the values that I expected, so the data itself appears correct.
REPRODUCE
One such case occurs after running the following gdalwarp command against the attached GeoTIF file to generate a BIL of a specified sub-region.
-> gdalwarp -overwrite -q -of ENVI -r bilinear -co INTERLEAVE=BIL -multi -te 68.74580536912751 24.995805369127517 70.00419463087249 26.254194630872483 -dstnodata -9999.0 -ot Int16 -ts 150 150 23N068E_20101117_gmted.tif output.bil
-> gdalinfo output.bil ERROR 1: Invalid band count : 2621482. Maximum allowed currently is 65536. Define GDAL_MAX_BAND_COUNT to a higher level if it is a legitimate number. gdalinfo failed - unable to open 'output.bil'.
WORKAROUND
Doing any of the following works around the problem in most cases, with gdalinfo successfully printing the correct metrics for output.bil:
ENVIRONMENT
GDAL 2.3.2 built on RHEL7 (x64).
23N068E_20101117_gmted.tif.zip
The text was updated successfully, but these errors were encountered: