[gdal-dev] Create big COG file (C++)

Even Rouault even.rouault at spatialys.com
Tue Sep 15 02:47:05 PDT 2020

On lundi 14 septembre 2020 21:38:33 CEST Javier Jimenez Shaw wrote:
> Thanks Even.
> So if I understand correctly, the steps would be:
>  1- Create() the GTiff dataset (with a valid filename)
>  2- write all the data with [many] RasterIO() calls
>  3- close the dataset (to dump everything into disk)
>  4- open the GTiff dataset in read mode
>  5- CreateCopy() with COG driver (with in a different valid filename),
> based on the dataset (opened in 1 or 4, see below)
>  6- close COG file.
>  7- optionally delete the GTiff file (if only COG is needed)
> I am not sure if I need steps 3 and 4. If not, should I move step 5 between
> 1 and 2?

You may skip step 3 and 4, and just close the GTiff dataset after CreateCopy().

> Looks like this duplicates used disk space, and takes time to write the
> second time. Why is it needed? Is there any workaround to create the COG
> directly?

No workaround. The COG driver needs to compute overviews, and given the current 
definition of the COG layout, it must write their data in the file before the full resolution 
imagery. No progressive writing is possible.


Spatialys - Geospatial professional services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200915/2cc6f56f/attachment.html>

More information about the gdal-dev mailing list