diff --git a/CHANGES.txt b/CHANGES.txt index e76b937..2a36bf8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,7 @@ -master (YYYY-MM-DD) -------------------- +1.1.4 (2019-10-03) +------------------ - - Fix support for optimizing open datasets, memfiles, and VRTs (#100) + - Fix support for optimizing open datasets, memfiles, and VRTs (#100 from j08lue) 1.1.3 (2019-09-16) diff --git a/README.md b/README.md index 6353a6c..4d2d39f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Cloud Optimized GeoTIFF (COG) creation and validation plugin for Rasterio [![Packaging status](https://badge.fury.io/py/rio-cogeo.svg)](https://badge.fury.io/py/rio-cogeo) [![CircleCI](https://circleci.com/gh/cogeotiff/rio-cogeo.svg?style=svg)](https://circleci.com/gh/cogeotiff/rio-cogeo) -[![codecov](https://codecov.io/gh/cogeotiff/rio-cogeo/branch/master/graph/badge.svg?token=zuHupC20cG)](https://codecov.io/gh/cogeotiff/rio-cogeo) +[![codecov](https://codecov.io/gh/cogeotiff/rio-cogeo/branch/master/graph/badge.svg)](https://codecov.io/gh/cogeotiff/rio-cogeo) ## Cloud Optimized GeoTIFF @@ -196,6 +196,42 @@ $ rio cogeo create mydataset.tif mydataset_raw.tif --co BLOCKXSIZE=1024 --co BLO See https://gdal.org/drivers/raster/gtiff.html#creation-options for full details of creation options. +## API + +Rio-cogeo can also be integrated directly in your custom script. See [rio_cogeo.cogeo.cog_translate](https://github.com/cogeotiff/rio-cogeo/blob/master/rio_cogeo/cogeo.py#L53-L108) function. + +e.g: + +```python +from rio_cogeo.cogeo import cog_translate + +def _translate(src_path, dst_path, profile="webp", profile_options={}, **options): + """Convert image to COG.""" + # Format creation option (see gdalwarp `-co` option) + output_profile = cog_profiles.get(profile) + output_profile.update(dict(BIGTIFF="IF_SAFER")) + output_profile.update(profile_options) + + # Dataset Open option (see gdalwarp `-oo` option) + config = dict( + GDAL_NUM_THREADS="ALL_CPUS", + GDAL_TIFF_INTERNAL_MASK=True, + GDAL_TIFF_OVR_BLOCKSIZE="128", + ) + + cog_translate( + src_path, + dst_path, + output_profile, + config=config, + in_memory=False, + quiet=True, + **options, + ) + return True +``` +ref: https://github.com/developmentseed/cogeo-watchbot/blob/81df27470dd2eb7032d512c35af853b006d1c035/app/translator.py#L34-L56 + ## Web-Optimized COG rio-cogeo provide a *--web-optimized* option which aims to create a web-tiling friendly COG. diff --git a/setup.py b/setup.py index b65831a..ceb9699 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup( name="rio-cogeo", - version="1.1.3", + version="1.1.4", description=u"CloudOptimized GeoTIFF (COGEO) creation plugin for rasterio", long_description=readme, long_description_content_type="text/markdown",