#!/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.48326077578235 56.513109310692194 -gcp 10629.0 0.0 21.48433795753103 56.48613639476752 -gcp 10629.0 12231.0 21.427938830828314 56.48543270238956 -gcp 0.0 12231.0 21.427100365681973 56.512621659359354 Aizpute-1988-991/Aizpute-1988-991-4.jpg Aizpute-1988-991-4.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "354.0 804.0\n10233.0 813.0\n10218.0 10737.0\n342.0 10722.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-4.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-4.vrt Aizpute-1988-991-4.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-4.cut.vrt Aizpute-1988-991-4.xyz