1

I have to calculate upfront from an polygon, how big the GeoTIFF is going to be in bytes. I have a fixed pixel size and know how many pixels there are going to be in the GeoTIFF. The GeoTIFF has only one band.

How is the relation between amount of pixels and file's size in GeoTIFFs?

Vince
  • 20,017
  • 15
  • 45
  • 64
Leo
  • 952
  • 6
  • 23

1 Answers1

5

Uncompressed file size in bytes =

bands * rows * cols * bit depth / 8 (+ a small amount for any geotiff/tiff header data)

Note - number of pixels = rows * cols

For example a single band 256 * 512 16bit integer Geotiff would be (1256512*16)/8 = 262,144 bytes with no header.

I just created a couple that were 262,546 bytes (no georeferencing) and 262,766 bytes (with georeferencing).

However, as Vince says, with compression, it's difficult to accurately predict TIFF size. For example, I created a Geotiff with the above dimensions, lots of random values and compression and the output was larger (351,610 bytes) than if I hadn't compressed it. Alternatively, a Geotiff with the same dimensions, but just a single value compresses very well (7,238 bytes)

user2856
  • 65,736
  • 6
  • 115
  • 196