#!/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 1362.0 3621.152584769316 21 57.5 -gcp 33646.5 3672.3268482490275 21.75 57.5 -gcp 33649.5 39441.38688160089 21.750183105468754 57.04946118043342 -gcp 1314.0 39087.17843246248 21.000344753265384 57.05181830090462 mapster/Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.jpg Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1362.0 3621.152584769316\n33646.5 3672.3268482490275\n33654.0 40482.576987215114\n1290.0 39711.34685936631" | \ gdaltransform -tps -output_xy Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.vrt Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.cut.vrt Estland-Lettland_100K_31_SW_Ventspils_(Windau)_III.1941_incomplete_nnVhXcf_BN_Sygn._ZZK_S-4_167_A_0001.xyz