Skip to content

Instantly share code, notes, and snippets.

@smathermather
Last active February 3, 2018 22:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smathermather/d948a252f5e417334244adc05c10790b to your computer and use it in GitHub Desktop.
Save smathermather/d948a252f5e417334244adc05c10790b to your computer and use it in GitHub Desktop.
REM Steps for processing for Level 1 ZMI Data
REM Create monstrous TIF of everything:
REM First prep the file
gdal_merge -o D:\FROM_ZMI\zmi_unguja_mosaic.tif -co TILED=YES --optfile list.txt -createonly -ps 0.07 0.07
REM Then merge in the tifs
FORFILES /m *.tif /C "CMD /C gdalwarp @file D:\FROM_ZMI\zmi_unguja_mosaic.tif"

REM Cut out square tiles from Zone grid
FORFILES /m "*.shp" /s /C "CMD /C gdalwarp -cutline @FILE D:\FROM_ZMI\zmi_unguja_mosaic.tif d:\FROM_ZMI\\@FNAME.tif"
REM Add overviews
FORFILES /m *.tif /s /C "CMD /C gdaladdo -r average --config COMPRESS_OVERVIEW DEFLATE @file 2 4 8 16 32 64 128 26 512 1024 2048 4096"

REM Combine back together in a VRT for viewing:
dir /B *.tif > list.txt -- no quotes need removed
gdalbuildvrt -input_file_list list.txt zmi_unguja_mosaic.vrt -srcnodata "0 0 0" -resolution user -tr 0.07 0.07 -overwrite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment