#!/bin/bash GDAL_TILE_PROCESSES=16 GDAL_TILE_ZOOMS=8-14 GDAL_SAMPLING_WARP=cubic GDAL_SAMPLING_TILE=antialias # Create virtual dataset with coordinates gdal_translate -of VRT -a_srs EPSG:4326 -outsize 300% 300% -gcp 0.0 0.0 23.753407 56.45890418 -gcp 14202.0 0.0 23.68896961 56.46747518 -gcp 14202.0 13953.0 23.69930999 56.49867167 -gcp 0.0 13953.0 23.76186132 56.4942012 GX2690/GX_2690_SD_frame_33.jpg GX_2690_SD_frame_33.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "360.0 1227.0\n11574.0 1062.08356545961\n11556.0 1896.0\n13800.0 1968.4011142061283\n13944.0 13607.986629526464\n1680.0 13608.588300835656\n1416.0 12551.692479108635\n360.0 12383.893036211699" | \ gdaltransform -tps -output_xy GX_2690_SD_frame_33.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_2690_SD_frame_33.vrt GX_2690_SD_frame_33.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_2690_SD_frame_33.cut.vrt GX_2690_SD_frame_33.xyz