Created
March 10, 2019 00:30
-
-
Save emxsys/a74f20c18d3383b2c01546a33b5de7a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set +x | |
# LandSat files | |
for file in /nas/data/imagery/i3/*.tif; do | |
input_file=${file} | |
base_file=`basename ${file}` | |
gtiff_file=gtif/${base_file%.*}.tif | |
if [ -s $gtiff_file ] | |
then | |
continue | |
fi | |
echo Converting $input_file to $gtiff_file | |
gdal_translate -of GTiff -co TILED=YES -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co COMPRESS=JPEG --config PHOTOMETRIC YCBCR $input_file $gtiff_file | |
# build the overviews in a background job | |
if [ -s $gtiff_file ] | |
then | |
echo Adding overviews to $gtiff_file | |
gdaladdo -r cubic --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL $gtiff_file 2 4 8 16 32 64 128 256 & | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment