Skip to main content

CloudOptimized GeoTIFF (COGEO) creation plugin for rasterio

Project description

Cloud Optimized GeoTIFF (COG) creation plugin for rasterio

https://badge.fury.io/py/rio-cogeo.svg https://circleci.com/gh/cogeotiff/rio-cogeo.svg?style=svg https://codecov.io/gh/cogeotiff/rio-cogeo/branch/master/graph/badge.svg?token=zuHupC20cG

Install

$ pip install -U pip
$ pip install rio-cogeo

Or install from source:

$ git clone https://github.com/cogeotiff/rio-cogeo.git
$ cd rio-cogeo
$ pip install -U pip
$ pip install -e .

Usage

$ rio cogeo --help
Usage: rio cogeo [OPTIONS] INPUT OUTPUT

  Create Cloud Optimized Geotiff.

Options:
  -b, --bidx BIDX                 Band indexes to copy.
  -p, --cog-profile [ycbcr|jpeg|webp|zstd|lzw|deflate|packbits|raw]
                                  CloudOptimized GeoTIFF profile (default: jpeg).
  --nodata NUMBER|nan             Force mask creation from a given nodata value.
  --alpha INTEGER                 Force mask creation from a given alpha band number.
  --overview-level INTEGER        Overview level (if not provided, appropriate overview level will be selected until the
                                  smallest overview is smaller than the internal block size).
  --overview-resampling [nearest|bilinear|cubic|cubic_spline|lanczos|average|mode|gauss] Resampling algorithm.
  --threads INTEGER
  --co, --profile NAME=VALUE      Driver specific creation options.See the documentation for the selected output driver
                                  for more information.
  --help                          Show this message and exit.

Examples

# Create a COGEO with JPEG profile and the first 3 bands of the data
$ rio cogeo mydataset.tif mydataset_jpeg.tif -b 1,2,3

# Create a COGEO without compression and with 1024x1024 block size
$ rio cogeo mydataset.tif mydataset_raw.tif --co BLOCKXSIZE=1024 --co BLOCKYSIZE=1024 --cog-profile raw

Default COGEO profiles

Profiles can be extended by providing ‘–co’ option in command line (e.g: rio cogeo mydataset.tif mydataset_zstd.tif -b 1,2,3 –profile deflate –co “COMPRESS=ZSTD” )

YCbCr DEPRECATED in 1.0

  • JPEG compression

  • PIXEL interleave

  • YCbCr colorspace

  • limited to uint8 datatype and 3 bands data

JPEG

  • JPEG compression

  • PIXEL interleave

  • YCbCr colorspace

  • limited to uint8 datatype and 3 bands data

WEBP

  • WEBP compression

  • PIXEL interleave

  • limited to uint8 datatype and 3 or 4 bands data

  • Available for GDAL>=2.4.0

ZSTD

  • ZSTD compression

  • PIXEL interleave

  • Available for GDAL>=2.3.0

Note in Nov 2018, there was a change in libtiff’s ZSTD tags which create incompatibility for old ZSTD compressed GeoTIFF link

LZW

  • LZW compression

  • PIXEL interleave

DEFLATE

  • DEFLATE compression

  • PIXEL interleave

PACKBITS

  • PACKBITS compression

  • PIXEL interleave

RAW

  • NO compression

  • PIXEL interleave

Default profiles are tiled with 512x512 blocksizes.

Contribution & Development

The rio-cogeo project was begun at Mapbox and has been transferred in January 2019.

Issues and pull requests are more than welcome.

dev install

$ git clone https://github.com/cogeotiff/rio-cogeo.git
$ cd rio-cogeo
$ pip install -e .[dev]

Python3.6 only

This repo is set to use pre-commit to run flake8, pydocstring and black (“uncompromising Python code formatter”) when commiting new code.

$ pre-commit install

Extras

Checkout rio-glui (https://github.com/mapbox/rio-glui/) rasterio plugin to explore COG locally in your web browser.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rio-cogeo-1.0.dev10.tar.gz (6.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page