#!/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 612.0 351.0 21.776666666666667 57.5 -gcp 15732.0 351.0 22.226666666666667 57.5 -gcp 15759.0 15837.0 22.226666666666667 57.25 -gcp 561.0 15828.0 21.776666666666667 57.25 bruno/II-11_w.y.jpg II-11_w.y.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "600.0 7279.499167129373\n4330.5 7315.495835646863\n4339.5 5290.500832870627\n600.0 5229.001665741255\n612.0 351.0\n15732.0 351.0\n15759.0 15837.0\n561.0 15828.0" | \ gdaltransform -tps -output_xy II-11_w.y.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ II-11_w.y.vrt II-11_w.y.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES II-11_w.y.cut.vrt II-11_w.y.xyz