Data preparation

Landsat 8

Next instruction describe process of prepare Landsat 8 data to use with EOS API.

Step 1. Unpack archive

In linux terminal use tar to unpack archive:

mkdir LC81780262014280LGN00 && tar -xvf LC81780262014280LGN00.tar.gz -C LC81780262014280LGN00 && cd LC81780262014280LGN00

Step 2. Convert GeoTIFF to tiled structure

Convert all bands files to tiled structure using gdal:

find . -type f -name "*.TIF" -printf "%f\n" | xargs -i sh -c 'gdal_translate -of GTiff -co "TILED=YES" -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512" -co "COMPRESS=DEFLATE" -co "PREDICTOR=2" {} _{}'

Step 3. Set environment variable

Set environment variable to tell gdal using specific tile block size for overview:

export GDAL_TIFF_OVR_BLOCKSIZE=512

Step 4. Create internal pyramid

For each GeoTIFF file create overview for make possible generate web tiles in lower zooms:

find . -type f -name "_*.TIF" -printf "%f\n" | xargs -i sh -c 'gdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE {} 2 4 8 16'

Step 5. Remove unpacked files and prefix

Clean working directory from original GeoTIFF files and remove prefix from prepared files:

find . -type f -name "LC8*.TIF" -printf "%f\n" | xargs rm && \
 find . -type f -name "_*" -printf "%f\n" | xargs -i sh -c 'mv {} $(echo {} | cut -c 2-)'

Step 6. Publish on web server (AWS S3)

Upload created folder with prepared GeoTIFF files to s3:

cd .. && aws s3 cp LC81780262014280LGN00 s3://example-bucket --recursive