13

A certain piece of software that I use doesn't support .tiff DEM's that are tiled. Is there a way with a GDAL utility to determine if a .tiff DEM is tiled or not?

gdalinfo dem.tif 

will report the compression type and the interleave type (band/pixel), but as far as I can tell, the interleave type doesn't have anything to do with tiling.

you can translate the tiff DEM with a creation option flag to make an untiled DEM, but that requires a translation and not just a report.

gdal_translate -co TILED=NO dem.tif dem_notile.tif

1 Answer 1

16

I haven't found any specific commandline utility that can report if a tiff is tiled or striped. At least not directly or in a grepable form like TILED=YES.

There should be enough information in gdalinfo to make that decision, however.

I have a landsat scene, each made with gdal_translate:

landsat_tiled.tif : -co TILED=YES

landsat_notiled.tif: -co TILED=NO

gdalinfo landsat_tiled.tif | grep -E 'Block=|Size is'
>>Size is 7621, 7791
>>Band 1 Block=256x256 Type=UInt16, ColorInterp=Gray

gdalinfo landsat_notiled.tif | grep -E 'Block=|Size is'
>>Size is 7621, 7791
>>Band 1 Block=7621x1 Type=UInt16, ColorInterp=Gray

So it is obvious that tiled tiffs have a Y block size greater than 1. Striped tiffs have X block size equal to XSize and Y block size equal to 1.

This should be enough to determine if they are striped (not tiled).

gdalinfo landsat_notiled.tif | grep -o 'Block=.*x1\s'
>>Block=7621x1

If that call returns anything, you can be sure it is NOT tiled.

This doesn't address very small tiffs, which can have the entire raster array stored in a single block. So YMMV on those..

1
  • 4
    I just created a tiled 50x1 tiff with gdal_translate -srcwin 0 0 50 1 -co tiled=YES input.tif test_tiled.tif. gdalinfo still reports Block=256x256 so your method will work for small tiffs as well.
    – user2856
    Commented Oct 5, 2016 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.