1

By its definition, a cloud optimized GeoTIFF is a regular GeoTIFF file, aimed at being hosted on a HTTP file server, whose internal organization is friendly for consumption by clients issuing.

Based on the gdal doc, I can create a cloud optimized tif by running

gdal_translate in.tif out.tif -co TILED=YES -co COPY_SRC_OVERVIEWS=YES -co COMPRESS=LZW  

on a file with existing overviews.

Because of the size of my tif files, I would like to avoid making my tif file "cloud optimized" after building the pyramid in order not to duplicate the writing.

Is it possible to use the -co COPY_SRC_OVERVIEWS=YES when I build my pyramids with gdaladdo or is it necessary to run it in an additional step ?

1

I fear you can't really write cloud optimised GeoTIFF directly if overviews are needed. In the document that you cited the structure of such GeoTIFF is

  1. TIFF / BigTIFF signature
  2. IFD (​Image File Directory) of full resolution image
  3. Values of TIFF tags that don't fit inline in the IFD directory, such as TileOffsets, TileByteCounts and GeoTIFF keys
  4. Optional: IFD (Image File Directory) of first overview (typically subsampled by a factor of 2), followed by the values of its tags that don't fit inline
  5. Optional: IFD (Image File Directory) of second overview (typically subsampled by a factor of 4), followed by the values of its tags that don't fit inline ...
  6. Optional: IFD (Image File Directory) of last overview (typically subsampled by a factor of 2N), followed by the values of its tags that don't fit inline
  7. Optional: tile content of last overview level

    ...

  8. Optional: tile content of first overview level
  9. Tile content of full resolution image.

When you create a new GeoTIFF with gdal_translate it writes the components 1, 2, 3 (if needed), and 9, in that order. I am not actually sure if 3 will be written after 2 or 9 but anyway, when you create overviews with gdaladdo they will be written after the component 9 because there is no space before it. Only once all the components exist and their sizes are known they can be re-organized into optimal order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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