Skip to main content
2 of 2
readability
Andre Silva
  • 10.3k
  • 12
  • 55
  • 109

I'd recommend using gdalwarp as you can increase the efficiency of the process.

For example, if you want to cut a raster inraster.tif with a shapefile extent.shp:

gdalwarp -cutline extent.shp -crop_to_cutline -of GTiff  -dstnodata 255 inraster.tif inraster_cropped.tif -co COMPRESS=LZW -co TILED=YES --config GDAL_CACHEMAX 2048 -multi

The last two parameters allows you to boost the process using:

  1. A multicore implementation.
  2. Setting the cache available to the function.
WAF
  • 625
  • 8
  • 22