Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
podcast
Filter by Categories
Galleries
Print Category 1
Print Category 2
Uncategorized

Complete guide to cloud-optimized GeoTIFFs

So what is a cloud-optimized GeoTIFF?

A cloud-optimized GeoTIFF (COG) is a format for storing and serving georeferenced raster imagery on the web. It is a regular GeoTIFF file that is optimized for use in a cloud-based environment, such as a web server or a cloud storage service.

The key feature of a COG is that it has a built-in internal organization that allows clients to access just the parts of the image they need, without having to download the entire file. This makes it more efficient to serve and less costly to store large raster datasets in the cloud.

COGs allow Raster Data to be steamed across the web without the need for a specialized GIS Server

TIFF, GeoTIFF, and COGs

TIFF (Tagged Image File Format) is a widely used raster image format, which supports lossless compression.

GeoTIFF is a TIFF format that includes geographic metadata, which allows the image to be placed accurately on the earth.

COG (Cloud Optimized GeoTIFF) is a variation of the GeoTIFF format optimized for use in a cloud environment. But it can also be used in all the same ways you would use a normal GeoTIFF!

FeatureTIFFGeoTIFFCOG
File TypeRasterRasterRaster
Geographic ReferenceNoYesYes
Cloud OptimizationNoNoYes
AccessibilityThe whole file must be downloadedThe whole file must be downloadedOnly required parts can be downloaded
Compression SupportYesYesYes
GIS compatibilityLimitedFullFull
StreamableNoNoYes

How to Create and visualize a Cloud-Optimized GeoTIFF In QGIS

How to Create and visualize a Cloud-Optimized GeoTIFF In ArcGIS Pro

For a more in-depth discussion on Geospatial Cloud Optimized Formats click here

Understanding Range Requests and Internal Tilling

Range requests and COGs

A range request is a type of HTTP request that allows clients to request only a specific portion of a file, rather than the entire file. This can be especially useful when working with large files, such as raster imagery, as it allows clients to download only the parts of the file they need.

Cloud Optimized GeoTIFFs (COGs) are designed to take advantage of range requests by including a built-in internal organization that allows clients to access just the parts of the image they need. This internal organization is achieved by dividing the image into small “tiles” and storing them separately. Each tile is a regular TIFF image, with its own header and metadata, and it can be requested independently.

When a client makes a range request for a specific tile, the server sends back only that tile, rather than the entire file. This can save time and bandwidth, as the client only needs to download the part of the image they are interested in.

For example, imagine a client wants to view a map of a specific location, the client can send a range request for the tile that contains that location, the server will send that tile, and the client can display it on the map.

Internal tiling and COGs

The internal tiling system of a Cloud Optimized GeoTIFF (COG) is a way of organizing the image data that allows clients to request only the parts of the image they need, without downloading the entire file. This is achieved by dividing the image into small “tiles” and storing them separately.

Each tile is a regular TIFF image, with its own header and metadata, that can be requested independently. The size of the tile is typically 256×256 pixels, but it can be set to any size depending on the user’s needs. Each tile is stored as a separate image file in the COG, and each file has its own header.

When a client requests a tile, the server sends back only that tile, rather than the entire file. This can save time and bandwidth, as the client only needs to download the part of the image they are interested in.

The tiling system also allows for creating overviews and different resolutions of the image. Overviews are lower-resolution versions of the image that can be used when the client is zoomed out, and higher-resolution versions when the client is zoomed in, this allows for better performance and reduces bandwidth usage.

The tiling system in COGs also enables the use of range requests, this is a feature that allows clients to request only specific portions of the image rather than the entire file. This can be especially useful when working with large raster images.

The internal tiling system of a COG is a way of organizing the image data that allows clients to request only the parts of the image they need using range requests, saving time and bandwidth and improving performance.

Converting COGs to Tiffs and Tiffs to COGs

To convert a TIFF file to a Cloud Optimized GeoTIFF (COG) using GDAL (Geospatial Data Abstraction Library), you can use the gdal_translate command.

Here is an example of how to use gdal_translate to convert a TIFF file to a COG:

Copy codegdal_translate -of COG input.tif output.tif

This command will create a new file, “output.tif”, which is a COG, from the input file “input.tif” which is a regular TIFF.

Additionally, you can use gdaladdo to create overviews of the image and gdal_translate to create an optimized version of the file.

Copy codegdaladdo -r average input.tif 2 4 8 16
gdal_translate -of COG -co TILED=YES -co COPY_SRC_OVERVIEWS=YES input.tif output.tif

You can also use rio_cogeo.py a python library to convert tiff files to COGs, it is built on top of GDAL and it provides a more pythonic way to convert tiffs to COGs.

Copy codepip install rio-cogeo
rio cogeo create input.tif output.tif

To convert a COG back to a regular TIFF, you can use the same command but with the output.tif as the input file and the desired name of the output TIFF file.

Copy codegdal_translate -of GTiff output.tif output_regular_tiff

Cloud-Optimized GeoTIFF FAQs

Can a COG be edited?

No, at the moment COGs are read-only. This means that in order to edit a COG you must overwrite it