#!/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 888.0 1479.0 24.626666666666665 57.083333333333336 -gcp 9474.0 1473.0 24.776666666666667 57.083333333333336 -gcp 9465.0 10242.0 24.776666666666667 57 -gcp 891.0 10245.0 24.626666666666665 57 131_Planup_28.9.17.jpg 131_Planup_28.9.17.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "888.0 1479.0\n9474.0 1473.0\n9465.0 10242.0\n891.0 10245.0" | \ gdaltransform -tps -output_xy 131_Planup_28.9.17.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 131_Planup_28.9.17.vrt 131_Planup_28.9.17.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 131_Planup_28.9.17.cut.vrt 131_Planup_28.9.17.xyz