Introduction

This guide will eventually be a stand alone explanation for developers on using and producing Cloud Optimized GeoTIFF's. If you are interested in contributing then please make pull requests on the Github Project. In the meantime this document will just link to a few other resources

Reading a Cloud Optimized GeoTIFF

For C/C++ or Python developers, the easiest way to read a COG in a way that takes advantage of its unique properties is to use GDAL and its VSI Curl functionality. See the GDAL Wiki on Cloud Optimized GeoTIFF in its How to read it with GDAL section. A majority of geospatial software in the world uses GDAL as a library, so incorporating it is likely the fastest way to incorporate COG reading in to your software.

Java developers may find more convenient to use pure Java readers that integrate well with the Java2D framework. Taking advantage of COG properties on file system, HTTP or S3 is possible for example with GeoTools and Apache SIS libraries.

Planet produces all its data as COG, and has a little tutorial on how to download part of an image using VSI Curl. Most of the tutorial is specific to working with the Planet API, but it shows the use of GDAL Warp with a COG to extract a single farm field from a larger image.

How to generate a Cloud Optimized GeoTIFF

As of version 3.1 of GDAL there is a built in COG provider which by default provides tiling and creation of overviews, use it like this:

 gdal_translate input.tif output_cog.tif -of COG -co COMPRESS=LZW

Older GDAL versions

There is a GDAL wiki page about COG creation: How to generate it with GDAL. For quick reference the one liner is:

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

Rio-cogeo

or you can use rio-cogeo plugin:

$ rio cogeo create in.tif out.tif --cog-profile deflate

Many other geospatial software should also be able to add the proper overviews and tiles. Please contribute examples!

Testing your Cloud Optimized GeoTIFF's

The validate_cloud_optimized_geotiff.py script can be used to check that a (GeoTIFF) file follows the above described file structure

$ python validate_cloud_optimized_geotiff.py test.tif
or
$ python
import validate_cloud_optimized_geotiff.py
validate_cloud_optimized_geotiff.validate("test.tif")

or you can use rio-cogeo plugin:

$ rio cogeo validate test.tif

Note: Radiant.Earth is also providing a hosted version of the validate_cloud_optimized_geotiff.py script. And if you want to run your own hosted version you can get the source code.

Performance

See COG Performance Testing on GDAL wiki for some of the initial performance testing

Digital Globe has also done extensive performance testing with their IDAHO project, and found the format as performant as their previous custom scheme.