Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
I had the same error, but in my case, the clip_mask shapefile contained a really small polygon, much smaller than a pixel of my input raster. So I had to identify when it happened so I could prevent clipping with shapefiles masks with really small polygons. (in my case, I checked for polygons with at least 5x the area of a pixel). Problem solved here too. Thanks for your question. –  hbobenicio Jan 18 '13 at 14:52

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

I had the same error, but in my case, the solution was slightly different. (I'm answering here as an alternative answer. Mine had nothing to do with rudivonstaden's answer).

The clip_mask shapefile contained a really small polygon, much smaller than a pixel of my input raster. So I had to identify when it happened so I could prevent clipping with shapefiles masks with really small polygons. (in my case, I checked for polygons with at least 5x the area of a pixel).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.