I want to crop a landcover raster (cell size 10 meters) to my project region. The problem is that the new raster has almost always an offset.

In the example I show below I made the new raster transparent: one can see the offset, which is more than 4 meters.

In ArcGIS there is an option in the toolbox environment to snap to another raster. Does it exist in QGIS or what could be the workaround?

I found another post here Specifying snap raster in QGIS? but its 2,5 years old, maybe it is possible nowadays. I know it depends on the coordiantes for the extent. But finding the right extent coordinates in order to prevent the offset is quite time consuming.

enter image description here

2 Answers 2


I wrote some code, which is the best solution I'm aware of at this stage when nice alternatives aren't available (e.g having pixel coordinates that are all divisible by 10cm or something)

See https://github.com/Mp3Robbo/QGIS_Raster_Snapping/

This determines the closest pixel corner in a base raster to the top left corner of an input raster, then puts the shifted extent in the parameter -a_ullr in gdal_translate

It requires the two rasters to have the same CRS and basically the same pixel size. You could modify the code to account for this if you wanted I guess

If there are any improvements to this let me know


I suggest using Freehand raster georeferencer plugin for raster shifting:

Interactive georeferencing of rasters

Tools to georeference a raster interactively (move, rotate, scale, export...)

It is also worth noting that the offset value may vary depending on the specific point in the raster. In this case, it is better to use the raster georeferencing tool built into QGIS (Georeferencer).

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.