[gdal-dev] Creating Cloud Optimized GeoTIFFs
anash
anash at protonmail.com
Mon Dec 17 15:21:09 PST 2018
Hi Even,
I have seen pretty much everywhere that COG's are created in 3 steps:
1. compress and tile the image
$ gdal_translate -co TILED=YES -co COMPRESS=DEFLATE in.tif tmp.tif
2. add overviews
$ gdaladdo -r average 2 4 8 16 tmp.tif
3. reorder overviews
$ gdal_translate -co TILED=YES -co COMPRESS=DEFLATE -co
COPY_SRC_OVERVIEWS=YES tmp.tif out.tif
However, it seems that we're tiling and compressing with gdal_translate
twice, which doesn't seem to be the most efficient way to do things.
I have run some initial tests on an untiled/uncompressed image basically
skipping step 1 and going straight to adding overviews and translating to
reorder, compress, and tile. The resulting image passes the COG validator
test, meaning it is a "valid" COG, though the overview offset values are
slightly different:
>>> validate(gdal.Open('tile_first_cog.tif'))
... ([], {'ifd_offsets': {'main': 8, 'overview_2': 31886, 'overview_3':
32822, 'overview_0': 18238, 'overview_1': 28966}, 'data_offsets': {'main':
180166631, 'overview_2': 2300609, 'overview_3': 33246, 'overview_0':
45588773, 'overview_1': 11129028}})
>>> validate(gdal.Open('no_init_tile_cog.tif'))
... ([], {'ifd_offsets': {'main': 8, 'overview_2': 31138, 'overview_3':
32074, 'overview_0': 17490, 'overview_1': 28218}, 'data_offsets': {'main':
180165883, 'overview_2': 2299861, 'overview_3': 32498, 'overview_0':
45588025, 'overview_1': 11128280}})
I am wondering, is there any downside to not starting with an initial
tiling/compression?
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list