#!/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 25.90701163 56.49654053 -gcp 21369.0 0.0 25.88002056 56.46983838 -gcp 21369.0 21381.0 25.82851946 56.48522453 -gcp 0.0 21381.0 25.86161792 56.51193213 GX769/GX_769_SD_frame_109.jpg GX_769_SD_frame_109.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "528.0 2022.0\n2472.0 1968.2272980501398\n2520.0 1103.7727019498602\n18384.0 1007.3047353760444\n18576.0 2424.38774373259\n20832.0 2496.454596100278\n20868.0 20927.959888579386\n2520.0 20856.066852367687\n1968.0 19415.745961002787\n672.0 19008.08022284122" | \ gdaltransform -tps -output_xy GX_769_SD_frame_109.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_769_SD_frame_109.vrt GX_769_SD_frame_109.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_769_SD_frame_109.cut.vrt GX_769_SD_frame_109.xyz