#!/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 21.346145868301395 56.68334691608077 -gcp 10548.0 0.0 21.346754885725645 56.65602620240062 -gcp 10548.0 12222.0 21.28941945955787 56.65554305570867 -gcp 0.0 12222.0 21.288789875404706 56.682813473054956 Aizpute-1988-991/Aizpute-1988-991-119.jpg Aizpute-1988-991-119.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "561.0 903.0\n10443.0 861.0\n10476.0 10746.0\n601.5 10792.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-119.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-119.vrt Aizpute-1988-991-119.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-119.cut.vrt Aizpute-1988-991-119.xyz