1

I'm cropping a large amount of geotiff images by use of geojson masks:

gdalwarp \
-of GTiff \
-co COMPRESS=JPEG \ 
-co TILED=YES \
-co BLOCKXSIZE=512 \
-co JPEG_QUALITY=85 \
-co NUM_THREADS=ALL_CPUS \
--config GDAL_CACHEMAX 5000 \
-cutline mask.geojson \
-crop_to_cutline \
-dstalpha \
-dstnodata 0.0 \
 source.tif out.tif

While this works fine the command takes ages to finish (a file is ~1GB). GDAL_CACHEMAX and NUM_THREAD_ALL did not bring much advantage in speed. Is there something else I can do? For example is it advisable to break the command in several steps? First crop then compress and change blocksize in another step?

Anatol
  • 475
  • 3
  • 11
  • Try breaking your command into warping then translate/compress https://gis.stackexchange.com/a/89549/2856 I don't know if this will affect speed, but you will get better compression. – user2856 Aug 30 '20 at 22:16
  • Increasing GDAL_CACHEMAX is not a magic wand. In optimal process there should be no need to keep very much data in cache. Is your source image tiled? – user30184 Aug 31 '20 at 05:25
  • 1
    Thanks for your answer. Unfortunately breaking the command did not change anything. What gives much more speed is the use of rasterio. It reduced the calculation from 1h to 5 minutes. – Anatol Aug 31 '20 at 14:13

0 Answers0