1

I am running QGIS 3.4.14 (current stable version) on OSX Mojave 10.14.5.

I have a vector mask that I want to use to clip out a region of an image. Image was a jpeg originally but I translated it to a tiff in Q.

Now I'm getting the error "ERROR 1: The transformation is already "north up" or a transformation between pixel/line and georeferenced coordinates cannot be computed for /path/to/file/boston.tif. There is no affine transformation and no GCPs. Specify transformation option SRC_METHOD=NO_GEOTRANSFORM to bypass this check."

I can't change the GDAL console call directly in this version of Q, as far as I'm aware, but based on a previous question I can edit it within the python console using the following answer from a similar problem:

import subprocess

cmd = "gdalwarp -of GTiff -cutline /path/to/mask/mask_poly.shp -cl mask_poly -crop_to_cutline /path/to/raster/boston.tif /path/to/output/_boston_clip.tif SRC_METHOD=NO_GEOTRANSFORM"

subprocess.run ([x for x in cmd.split(" ") if x != ""])

I don't get any errors but no file seems to be created. Does anyone know a way to resolve this error?

The above solution was posted at How to edit the GDAL/OGR console call in QGIS 3.0?

1
  • If you add check=True or change the subprocess call to subprocess.check_call you might get some useful error output.
    – Ryan
    Commented Dec 18, 2019 at 18:52

1 Answer 1

1

I managed to resolve the issue. The error in my case resulted from the image not being georeferenced. So even though the vector mask was correctly referenced compared to the original image, QGIS (I believe) needs to have those points referenced in a projected coordinate system.

So, find a georeferenced raster image of your area, create GCPs in the raster georeference tool, and transform your original image to the georeferenced one. Then draw your clip mask.

That should work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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