#!/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 26.229618682759103 57.520941703409875 -gcp 16644.0 0.0 26.624109930752116 57.517425798093015 -gcp 16644.0 16677.0 26.616604175453656 57.3065931916938 -gcp 0.0 16677.0 26.22384872137645 57.30966631792454 202-Vidaga_1924.jpg 202-Vidaga_1924.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"2004.0 1614.0\n2208.0 14771.624791782344\n14907.0 14583.0\n14663.625 1407.7504164353138\" | \ gdaltransform -tps -output_xy 202-Vidaga_1924.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 202-Vidaga_1924.vrt 202-Vidaga_1924.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 202-Vidaga_1924.cut.vrt 202-Vidaga_1924.xyz