Skip to main content

CloudOptimized GeoTIFF (COGEO) creation plugin for rasterio

Project description

Cloud Optimized GeoTIFF (COG) creation and validation 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

Or install from source:

Usage

  • Create a Cloud Optimized Geotiff.

  • Check if a Cloud Optimized Geotiff is valid.

Examples

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.

Overview levels

By default rio cogeo will calculate the optimal overview level based on dataset size and internal tile size (overview should not be smaller than internal tile size (e.g 512px). Overview level will be translated to decimation level of power of two.

Internal tile size

By default rio cogeo will create a dataset with 512x512 internal tile size. This can be updated by passing –co BLOCKXSIZE=64 –co BLOCKYSIZE=64 options.

Web tiling optimization

if the input dataset is aligned to web mercator grid, the internal tile size should be equal to the web map tile size (256 or 512px) output dataset is compressed,

if the input dataset is not aligned to web mercator grid, the tiler will need to fetch multiple internal tiles. Because GDAL can merge range request, using small internal tiles (e.g 128) will reduce the number of byte transfered and minimized the useless bytes transfered.

Nodata, Alpha and Mask

By default rio-cogeo will forward any nodata value or alpha channel to the output COG.

If your dataset type is Byte or Unit16, you could use internal bit mask (with the –add-mask option) to replace the Nodata value or Alpha band in output dataset (supported by most GDAL based backends).

Note: when adding a mask with an input dataset having an alpha band you’ll need to use the bidx options to remove it from the output dataset.

Important

Using internal nodata value with lossy compression (webp, jpeg) is not recommanded. Please use internal masking (or alpha band if using webp)

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

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.

Extras

Blog post on good and bad COG formats: https://medium.com/@_VincentS_/do-you-really-want-people-using-your-data-ec94cd94dc3f

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.0b0.tar.gz (12.1 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