MCPcopy Index your code
hub / github.com/airbusgeo/cogger

github.com/airbusgeo/cogger @v0.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.1 ↗ · + Follow
85 symbols 212 edges 8 files 22 documented · 26% updated 9mo agov0.1.1 · 2025-09-19★ 1323 open issues

Browse by type

Functions 66 Types & classes 19
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Cogger

Go Reference License

Cogger is a standalone binary and a golang library that reads an internally tiled geotiff (optionally with overviews and masks) and rewrites it as a Cloud Optimized Geotiff (COG). This process being a reshuffling of the original geotiff's bytes, it should run as fast as the underlying disk or network i/o.

Cogger does not do any pixel manipulation on the provided image, it is up to you to provide an input geotiff which can be suitably transformed to a COG, namely:

  • it must be internally tiled
  • it should be compressed with one of the standard supported tiff compression mechanisms
  • it should contain overviews

Installation

Binaries

We publish the cogger binaries for the major platforms/cpus, which you can grab from our releases

From source

The library version of cogger can be used in go code with:

import "github.com/airbusgeo/cogger"

The cogger binary can be installed directly to your $GOPATH/bin with:

go install github.com/airbusgeo/cogger/cmd/cogger@latest

Usage

Binary

With internal overviews

gdal_translate -of GTIFF -co BIGTIFF=YES -co TILED=YES -co COMPRESS=ZSTD -co NUM_THREADS=4 input.file geotif.tif
gdaladdo --config GDAL_NUM_THREADS 4 --config COMPRESS_OVERVIEW ZSTD geotif.tif 2 4 8 16 32
cogger -output mycog.tif geotif.tif

With external overviews

gdal_translate -of GTIFF -co BIGTIFF=YES -co TILED=YES -co COMPRESS=ZSTD -co NUM_THREADS=4 input.file geotif.tif
gdaladdo -ro --config GDAL_NUM_THREADS 4 --config COMPRESS_OVERVIEW ZSTD geotif.tif 2 4 8 16 32 #creates geotif.tif.ovr
cogger -output mycog.tif geotif.tif geotif.tif.ovr

Library

The cogger API consists of a single function:

func Rewrite(out io.Writer, readers ...tiff.ReadAtReadSeeker) error

with the reader allowing random read access to the input file, i.e. implementing

Read(buf []byte) (int,error)
ReatAt(buf []byte, offset int64) (int,error)
Seek(off int64, whence int) (int64,error)

The writer is a plain io.Writer which means that the output cog can be directly streamed to http/cloud storage without having to be stored in an intermediate file.

For an full example of library usage, see the main.go file in cmd/cogger.

Advanced

Cogger is able to assemble a single COG from a main tif file and overviews that have been computed in distinct files. This may be useful as gdaladdo is missing some features to fine tune the options of each individual overview.

gdal_translate -of GTIFF -co BIGTIFF=YES -co TILED=YES -co COMPRESS=ZSTD -co NUM_THREADS=4 input.file geotif.tif
# compute first overview
gdal_translate -of GTIFF -outsize 50% 50% -co BLOCKXSIZE=128 -co TILED=YES -co COMPRESS=ZSTD -co NUM_THREADS=4  geotif.tif ovr.tif.1
# compute second overview
gdal_translate -of GTIFF -outsize 50% 50% -co BLOCKXSIZE=256 -co TILED=YES -co COMPRESS=ZSTD -co NUM_THREADS=4  ovr.tif.1 ovr.tif.2
# compute third overview
gdal_translate -of GTIFF -outsize 50% 50% -co BLOCKXSIZE=512 -co TILED=YES -co COMPRESS=ZSTD -co NUM_THREADS=4  ovr.tif.2 ovr.tif.3
# compute COG from geotif.tif and ovr.tif.* overviews
cogger -output mycog.tif geotif.tif ovr.tif.1 ovr.tif.2 ovr.tif.3

Contributing

Contributions are welcome. Please read the contribution guidelines before submitting fixes or enhancements.

Licensing

Cogger is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 43
Function 23
Struct 13
TypeAlias 4
FuncType 1
Interface 1

Languages

Go100%

Modules by API surface

stripper.go32 symbols
cog.go32 symbols
loader.go5 symbols
field.go5 symbols
stripper_test.go4 symbols
cogger_test.go3 symbols
cmd/pcogger/parallel-cogger.go2 symbols
cmd/cogger/main.go2 symbols

For agents

$ claude mcp add cogger \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page