#!/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 2177.625 281.66060521932263 108.00156609 80.00095926 -gcp 12964.5 333.12222376457527 132.00332472 80.00161987 -gcp 15049.125 10540.244100499724 132.00238641 76.0007418 -gcp 61.5 10485.442670738477 108.00056207 76.00088897 -gcp 7570.875 862.5662132148807 120.00209963 80.00090744 -gcp 4859.25 707.391588006663 114.00144926 80.00093926 -gcp 10280.830433316685 732.8894418559349 126.00272698 80.00086418 -gcp 11316.580433316685 11097.275199768206 126.00195752 76.00079526 -gcp 7553.25 11271.24319822321 120.00150718 76.0008379 -gcp 3801.036646780898 11058.186925508286 114.00104032 76.00086925 -gcp 1644.0 2830.187881732371 108.00071259 79.00094213 -gcp 1116.0 5378.328289838978 108.00065398 78.0009247 -gcp 582.0 7935.435383120488 108.00060446 77.00090698 -gcp 14538.75 7984.954122709605 132.00256639 77.0007592 -gcp 14015.625 5430.432051637979 132.00277667 78.00077635 -gcp 13486.3125 2879.6839255968907 132.0030255 79.00079326 -gcp 4318.125 5887.228484175458 114.00121045 78.00090482 -gcp 7561.5 6066.191560244309 120.00175366 78.00087322 -gcp 10801.5 5914.703636868407 126.00227764 78.00083024 -gcp 7563.9375 3463.5409147695727 120.00191081 79.00089047 -gcp 7559.34375 8667.855566352027 120.00162085 77.00085569 vlasenko/north/t-49_50_51_52.jpg t-49_50_51_52.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2177.625 281.66060521932263\n12964.5 333.12222376457527\n15049.125 10540.244100499724\n61.5 10485.442670738477" | \ gdaltransform -tps -output_xy t-49_50_51_52.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ t-49_50_51_52.vrt t-49_50_51_52.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES t-49_50_51_52.cut.vrt t-49_50_51_52.xyz