#!/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.39301920764599 56.6598065997703 -gcp 10605.0 0.0 21.390852928161625 56.63248859045706 -gcp 10605.0 12195.0 21.33432269096375 56.633798575904585 -gcp 0.0 12195.0 21.33617877960205 56.6609203923427 Aizpute-1988-991/Aizpute-1988-991-102.jpg Aizpute-1988-991-102.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "150.0 1566.0\n715.5 11430.0\n10578.0 10818.0\n9952.5 945.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-102.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-102.vrt Aizpute-1988-991-102.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-102.cut.vrt Aizpute-1988-991-102.xyz