#!/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 2286.0 2127.0 25.826666666666668 57 -gcp 25173.0 2103.0 26.276666666666667 57 -gcp 25347.0 25485.0 26.276666666666667 56.75 -gcp 2283.0 25545.0 25.826666666666668 56.75 bruno/IV-20_1917.jpg IV-20_1917.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2286.0 2127.0\n25173.0 2103.0\n25347.0 25485.0\n2283.0 25545.0" | \ gdaltransform -tps -output_xy IV-20_1917.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ IV-20_1917.vrt IV-20_1917.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES IV-20_1917.cut.vrt IV-20_1917.xyz