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.

I have a raster file and want to clip it, a vector file is supposed to be the mask layer. I use the most obvious method (Raster->Extraction->Clipper). No matter what I do, I get this error (see pic):

Cannot compute bounding box of cutline

I tried it with changing the raster format, changing the projection etc. Of course I made research in older posts/Google too. I have no Idea how to solve this problem. If I clip by extend it does work.

Weird thing is, I remember doing this three months ago, same method and I did not get this error.

I also would (instead of a solution for this error) welcome an alternative way to perform this action. I just need to clip a rasterfile as described. Can someone help? Thanks.


share|improve this question
strange. guess: check, if your raster and your vectorfile have the same projection –  Kurt Aug 29 '12 at 7:42
you mean right click on layer and then set crs, right? I did. It is the same. –  Shepherdjo Aug 29 '12 at 7:53
Have you tried a polygon that lies completely inside the raster? For example by intersecting your polygon with another rectangular polygon that has the exact extend of the raster. –  Andre Joost Aug 29 '12 at 8:35
Hm..I understand what you mean. But how can I get a polygon that has the the exact extend of the raster? –  Shepherdjo Aug 29 '12 at 9:06
Vector -> Research Tools -> Polygon from layer extend –  Andre Joost Aug 29 '12 at 9:51
add comment

6 Answers

up vote 7 down vote accepted

After trying around with everything I finally figured out how to solve the problem. It had indeed to do with the CRS. Right click "Set CRS" was not enough here. I had to perform (on the raster) Raster->Projections->Warp, then set the desired CRS again and save as Geotiff.

The mask layer (vector layer) had to be saved again with the same CRS. After that the process worked.

Still weird, because I know, that in 1.7.4 it did work immediately. I can remember pretty well, because that was when I started with QGIS. At any rate, thanks for everybody's help!

share|improve this answer
glad it works fine now! –  Kurt Aug 30 '12 at 7:37
Don't forget to accept your own answer :-) –  Andre Joost Aug 30 '12 at 9:53
:) yea, even though it s kind of weird doing this...I still have to wait 20 hours to do this. –  Shepherdjo Aug 30 '12 at 10:27
add comment

Since you don't want to do a clip by extend I assume you want to extract the raster cells that are inside each geometric figure of the vector file.

One way to do this, is to add a field in the vector file with the value 1, export it to raster format with the same resolution as the raster you have. This will create you a raster with value 1 for the geometric figures and 0 for the background. Finally you just need to multiply both rasters.

share|improve this answer
ok, I made a raster of the vector file with the field with the value 1, same resolution. What do you mean with "multiply both rasters"? –  Shepherdjo Aug 29 '12 at 9:17
by using the qgis raster calculator. check this tutorial: spatialgalaxy.net/2012/01/25/using-the-qgis-raster-calculator –  A.R Aug 29 '12 at 9:20
So...not completely sure but: my expression has to be simply raster1(derived from vector) * raster2(actual raster), right? –  Shepherdjo Aug 29 '12 at 9:39
add comment

Not an answer I'm afraid, but as a test I've just used the Raster -> Extraction -> Clipper method to clip a raster image with no problems at all. The illustration shows the clipped part of the map image together with the polygon used for clipping.

QGIS Master, Ubuntu 12.04 (64-bit). You're in Windows by the look of it, what version of QGIS are you using?


enter image description here

share|improve this answer
I know this method actually works pretty fine. But I think I m on the right track...I just need to try around more.. Qgis Version is 1.8.0. –  Shepherdjo Aug 29 '12 at 11:20
Just triple-checking. The raster and the polygon vector both have the same native CRS? In other words, they align properly with on-the-fly transformation disabled? If so, it might be worth trying again with OTF turned off. It might also be worth checking the validity of the vector layer's geometry (from under the Vector menu). N. –  nhopton Aug 29 '12 at 11:33
@shepherdjo did you check, what nhopton asked you to do: check geometry validity of your vector layer via vector-geometry tools - check geometry validity?? –  Kurt Aug 29 '12 at 20:43
@nhopton, @Kurt; I figured it out, see answer. –  Shepherdjo Aug 30 '12 at 6:25
add comment

After removing the '.prj' files from the directory with my shapefiles, my batch file ran without a hitch. Solution discovered here.

share|improve this answer
add comment

I had the same problem, and i solved it by use the command dissolve to generate the vector layer. Now the clipper work fine.

Bye bye


share|improve this answer
add comment

I had this problem as well. I was trying to clip a Geotiff Raster which I had exported previously from AutoCAD Rasterdesign. There seemed to be multiple problems with this Geotiff. Since I had the same error message "cannot compute bounding box of cutline" I reprojected the file with gdalwrap without setting any CRS for "source" nor for "target". after this process I was not able to open the Geotiff. So I figured that additionally to this problem, the compression of the export in AutoCAD had to be set to "JPG" and not "raw-data". Then I repeated the solution from above and I was finally able to reproject, save and clip the file!!!! Haleluja.

share|improve this answer
add comment

Your Answer


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.