#!/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 1044.0 787.6902268760907 35.99796387 60.00001024 -gcp 12910.5 767.4258289703316 41.99807408 60.00010031 -gcp 13637.25 16530.897905759164 41.99827759 56.00003046 -gcp 373.5 16568.458987783597 35.99817902 55.99994419 -gcp 6973.875 904.5298792337591 38.99801626 60.0000559 -gcp 6999.9375 16697.863929761246 38.99822587 55.99998792 -gcp 3021.75 858.0542986425339 36.99830853 59.98028731 -gcp 4992.75 888.8280542986425 37.99416701 59.97116362 -gcp 8954.25 881.3604826546002 39.99562995 59.97137353 -gcp 10935.75 847.5848416289592 40.99764925 59.97952085 -gcp 13083.75 4709.077677224735 41.99396405 58.95814731 -gcp 13265.25 8654.134615384615 41.99395025 57.94345093 -gcp 11421.0 16623.203242835596 40.9937071 55.97939205 -gcp 4869.0 16683.198340874813 38.03124449 55.96943359 -gcp 9210.75 16674.229260935143 39.99362769 55.96865558 -gcp 2578.875 16639.626508295627 36.99600367 55.98141133 -gcp 540.0 12619.703242835596 35.997537 56.95948582 -gcp 708.0 8670.478695324284 35.99756546 57.94644489 -gcp 876.375 4720.973227752639 35.99777374 58.96128396 -gcp 6977.25 4842.934766214178 38.99320434 58.92639477 -gcp 6984.75 8797.76282051282 38.99353242 57.91062239 -gcp 6991.5 12748.174962292607 38.99349816 56.92381287 -gcp 9073.875 8780.778092006034 39.99043348 57.9137337 -gcp 4882.875 8780.800339366517 37.99080872 57.91611732 vlasenko/north/o-37.jpg o-37.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1044.0 787.6902268760907\n12910.5 767.4258289703316\n13637.25 16530.897905759164\n373.5 16568.458987783597" | \ gdaltransform -tps -output_xy o-37.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ o-37.vrt o-37.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES o-37.cut.vrt o-37.xyz