3

I have been struggling with something since yesterday and Google did not help much...

I am working with two raster images, same projection (I re-projected one of them, they were originally different), same resolution and same extent. BUT the cell grids won't align. I am attaching a picture for you...

I tried a couple of things, like the align tool on QGIS and also re-sampling. The re-sampling "worked", the cell grid got aligned but the values of my DEM raster got all messed up... Is there any way I can "force" than to align? Any advice, tips?

enter image description here

  • 1
    Out of curiosity, how did you reproject the raster? And what happened when you used the Align Rasters tool? – Joseph May 10 '17 at 9:46
  • 1
    Can you add the metadata of the layers to your question, especially extent, number of rows and columns and cell size? – AndreJ May 10 '17 at 11:29
  • I reprojected it using the "wrap tool". And after I used the Align tool, the values of my DEM were getting all messed up. After posting here I realized they were not actually in the same extent. But I solved it resampling only the green raster, using R.... Thanks anyway – TFA May 11 '17 at 12:36
1

When you reproject in QGIS, it is using something called gdalwarp under the hood. Try explicitly setting the -te (target extent) and -tr (target resolution) options explicitly to exactly match the raster you want to align to. These values are implicit if unspecified. To coerce conformity, you may also need to use the -tap (target aligned pixels) option, but depending on the alignment of your comparison (unprojected) raster, you may also have to warp that one in the same projection but with -tap on (ie warp both using -tap).

To do this, set up your warp command in the usual way and then click the yellow pencil button by the text box at the bottom of the dialog. You can now edit the gdalwarp command following the documentation.

1

Thank you very much for the help guys. I solved it using R to resample only one of my layers. They align perfectly now.

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.