How to best prepare the data for managed Sentinel Hub processing?

Home > Faq > How to best prepare the data for managed Sentinel Hub processing?

The requirements are:

  • that data are in cloud optimized geotiff (COG), with each band in a single file.
  • the internal tile size must be equal across all overview levels (including the full resolution source)
  • the projection needs to be one of: WGS84 (EPSG:4326), WebMercator (EPGS:3857), or any UTM zone (EPSG:32601-32660, 32701-32760).

Bands can have different resolutions.

For best performance we recommend the following setting for COGs. Deflate compressed with 1024x1024 pixel internal tiling at full resolution and on overview levels. This can be generated using GDAL, for example, with the following commands:

gdal_translate -of GTIFF input.tif intermediate.tif

(If your input data has nodata values add them to this command using: -a_nodata NO_DATA_VALUE, e.g. for zero: -a_nodata 0 and the full command: gdal_translate -of GTIFF -a_nodata 0 input.tif intermediate.tif)
 

gdaladdo -r average --config GDAL_TIFF_OVR_BLOCKSIZE 1024 intermediate.tif 2 4 8 16 32

(The number of overview levels you need depends on your source data. A good rule of thumb is to have as many overview levels as necessary for the entire source image to fit on one 1024x1024 tile).
 

gdal_translate -co TILED=YES -co COPY_SRC_OVERVIEWS=YES --config GDAL_TIFF_OVR_BLOCKSIZE 1024 -co BLOCKXSIZE=1024 -co BLOCKYSIZE=1024 -co COMPRESS=DEFLATE intermediate.tif output.tif

NOTE: for many types of data adding a predictor can further reduce the file size. It is best you test this on your own data, to enable the predictor add -co PREDICTOR=2 to the above command.

Once the commands finish you can delete the intermediate.tif file.

 

For more information about each command see the GDAL documentation:
https://www.gdal.org/gdal_translate.html and
https://www.gdal.org/gdaladdo.html