[GIS] error message when clipping raster with vector layer

gdalqgis

When I try to crop a raster using QGIS Clipper tool, I get the following error message: ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.. Why?

The code QGIS generated to perform the clip was as follows: $ gdalwarp -q -cutline <clip_mask>.shp -crop_to_cutline -of GTiff <input_raster>.tif <output_raster>.tif

The same error message is generated if I try to run the gdalwarp command by itself from the commandline.

Best Answer

This error occurred because the raster and vector were not in the same projection. In this case, the vector layer had to be reprojected to match the raster CRS.

Related Question