#!/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 610.5 549.2171945701357 20.833333333333332 58.333333333333336 -gcp 5608.5 556.7631975867271 28.666666666666668 58.333333333333336 -gcp 5316.0 4022.0407239819006 27.5 55.666666666666664 -gcp 442.5 4005.3174962292605 20.833333333333332 55.666666666666664 2_izdevums/00_Parskats.jpg 00_Parskats.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "315.0 462.0\n1696.5 475.50301659125194\n3079.5 475.5067873303167\n5904.0 462.0\n5916.0 4200.0\n3118.5 4187.993212669683\n336.0 4203.0" | \ gdaltransform -tps -output_xy 00_Parskats.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 00_Parskats.vrt 00_Parskats.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 00_Parskats.cut.vrt 00_Parskats.xyz