#!/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 1323.0 1620.0 22.913183333333333 57.69295 -gcp 21945.0 1866.0 24.1349 57.754 -gcp 21804.0 16527.0 24.215583333333335 57.2808 -gcp 1224.0 16461.0 23.004 57.22128333333333 1915_3verst_ru_126k/7-3.jpg 7-3.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1272.75 9043.501665741254\n1323.0 1620.0\n11634.0 1733.9950027762352\n21945.0 1866.0\n21876.0 9199.501665741254\n21804.0 16527.0\n11517.0 16504.505830094393\n1224.0 16461.0" | \ gdaltransform -tps -output_xy 7-3.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 7-3.vrt 7-3.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 7-3.cut.vrt 7-3.xyz