#!/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 3357.3465232592116 4489.326912960003 24.78783846 57.26918238 -gcp 17793.666884602724 4220.133090567272 24.79191542 57.3275174 -gcp 19122.79826480469 17810.744467884222 24.89116788 57.33030943 -gcp 1376.0631552464276 17747.718972648836 24.88605559 57.25867526 GX8464/GX_8464_SK_frame_285.jpg GX_8464_SK_frame_285.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "912.0 2592.0\n744.0 19609.39052924791\n20928.0 19705.49749303621\n20976.0 2328.0" | \ gdaltransform -tps -output_xy GX_8464_SK_frame_285.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_8464_SK_frame_285.vrt GX_8464_SK_frame_285.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_8464_SK_frame_285.cut.vrt GX_8464_SK_frame_285.xyz