mapbox / preprocessorcerer

Perform preprocessorcery and pick parts on particularly persnickity uploads
ISC License
12 stars 8 forks source link

Ensure BIGTIFF format is used for outputs, if needed #52

Open springmeyer opened 9 years ago

springmeyer commented 9 years ago

Both #45 and https://github.com/mapbox/node-wmtiff will lead to tiffs generated without compression - which is intended and ideal since reading uncompressed tiffs is faster.

But we need to ensure that tiffs that end up being larger than 4 GB after decompression are encoded as bigtiff. GDAL should do this automatically as per http://www.gdal.org/frmt_gtiff.html:

When creating a new GeoTIFF with no compression, GDAL computes in advance the size of the resulting file. If that computed file size is over 4GiB, GDAL will automatically decide to create a BigTIFF file. However, when compression is used, it is not possible in advance to known the final size of the file, so classical TIFF will be chosen. In that case, the user must explicitly require the creation of a BigTIFF with BIGTIFF=YES if the final file is anticipated to be too big for classical TIFF format. If BigTIFF creation is not explicitly asked or guessed and the resulting file is too big for classical TIFF, libtiff will fail with an error message like "TIFFAppendToStrip:Maximum TIFF file size exceeded".

But we should have a unit test for this to make sure this behavior works as expected.