#!/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 690.75 285.1349250416435 11.99775448 59.99961549 -gcp 8604.75 281.43697945585785 17.9977707 59.99971721 -gcp 9076.5 10790.406579677958 17.99800626 55.9996635 -gcp 236.52987257843844 10808.788307356017 11.99799175 55.99956606 -gcp 4645.5 372.47515269294837 14.99775952 59.99966644 -gcp 4659.0 10896.807051637978 14.99799626 55.99961487 -gcp 2011.5 332.2964325374792 12.99910009 59.98046733 -gcp 3329.625 360.2102998334259 13.99760001 59.96903852 -gcp 5967.75 355.9214325374792 15.99603929 59.97028603 -gcp 7287.375 332.2968489727929 16.99683571 59.97953001 -gcp 8716.5 2908.9082107162685 17.99326377 58.95841098 -gcp 8833.125 5536.943607717934 17.99248368 57.94463481 -gcp 8952.375 8164.903317601333 17.99357974 56.95825759 -gcp 7605.75 10846.545703775679 16.99753373 55.98054648 -gcp 6132.375 10882.592240421987 15.99700127 55.96867402 -gcp 3184.125 10888.7292476402 13.99762884 55.96865323 -gcp 1711.5 10863.078081621323 12.99908352 55.978962 -gcp 348.9375 8179.346127151583 11.99718274 56.95815222 -gcp 463.3125 5551.16081343698 11.9977752 57.94318281 -gcp 577.3125 2919.218316213215 11.99800606 58.95705028 -gcp 4650.375 8272.35226957246 14.99314688 56.92114877 -gcp 4647.375 5634.787895613548 14.99248975 57.90942314 -gcp 3252.0 5625.460993892282 13.99413776 57.9136316 -gcp 6044.8125 5619.054136590783 15.99279041 57.91473477 -gcp 4643.625 3002.8464394780676 14.99124008 58.92305526 vlasenko/north/o-33.jpg o-33.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "690.75 285.1349250416435\n8604.75 281.43697945585785\n9076.5 10790.406579677958\n236.52987257843844 10808.788307356017" | \ gdaltransform -tps -output_xy o-33.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ o-33.vrt o-33.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES o-33.cut.vrt o-33.xyz