Is it possible to clip a polygon from a raster layer without being georeferenced? When I try I get this error message "ERROR 1: Unable to compute a transformation between pixel/line and georeferenced coordinates" and am not really sure what it means. I'm speculating that it wants me to georeference the raster layer but I can't as it is a photo, not a map (not a photo of a map) and if I just georeference arbitrarily to try and placate it then the pictures warps.


While the raster may be left un-georeferenced, a vector layer can not. You need coordinates in a defined CRS for the vertices of the polygon.

What you can do:

Choose an arbitrary projected CRS (like Web mercator EPSG:3857), and set the extent of the raster with gdal_translate -a_ullr (see http://www.gdal.org/gdal_translate.html) exactly to the size of the raster. This prevents the raster from getting stretched. Make sure that the layer and project CRS are EPSG:3857 if it does not look as expected.

Then you can create a polygon layer in the same CRS, and use the clip function.


Your issue seems to be a bit tricky. Gdalwarp expects to do some kind of transforming, but fails on an identical reprojection.

This way it works for me:

gdal_translate -of Gtiff -a_srs EPSG:3857 -a_ullr 0 3456 4608 0 Aarhus.jpg AarhusNew.tif
gdalwarp -q -cutline clippoly.shp -tr 1.0 1.0 -of GTiff -dstnodata 0 AarhusNew.tif -overwrite  clipped.tif

You have to re-create the clip layer, because all coordinates are now positive (whereas negative Y values fail in your example, beeing identical to the internal pixel/line reference).

looking like this:

enter image description here

  • When I imported/ created the layers previously I have already been setting the CRS as 3857 and getting error message ERROR 1. I'm not really sure what the gdal translate is meant to do but when I run it I get the message "Input file size is 4608, 3456 Computed -srcwin 0 0 4608 -3455 from projected window. Error: Computed -srcwin 0 0 4608 -3455 has negative width and/or height" – Monica Aug 21 '16 at 12:34
  • I still get exactly the same error message – Monica Aug 22 '16 at 12:33
  • Can you upload a sample file via dropbox or similar? – AndreJ Aug 22 '16 at 15:35
  • Dunno if I've done this correctly but here is a link to the file I'm playing with: dropbox.com/s/qbsh4lsj29uqrke/practice.qgs?dl=0 For bonus points, this one has my standard error message on it: dropbox.com/s/wv6lmqbd9a4cy2p/… – Monica Aug 23 '16 at 18:43
  • The .qgs file does not reveal everything. Adding the tif (or png) and shapefile (with shx/dbf/prj, maybe zipped) might help to reproduce the error. – AndreJ Aug 24 '16 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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