1

I have two rasters. Let's call them "Green" and "Red".

The details for the "Green" raster are:

enter image description here

enter image description here

The details for the "Red" raster are:

enter image description here

enter image description here

There is a small skew between these two rasters and the pixels are also not perfectly overlapping. enter image description here enter image description here

I would like to remove this skew that exist between the two rasters (to make the rows and columns parallel to each other) and also have perfectly overlapping pixels (with equal number of rows and columns). What processing chain is necessary to achieve this in QGIS (without disturbing the pixel values and retaining the image statistics as much as possible)?

2
  • There are many different properties of two rasters. "Pixel size", "data type", "crs" and "width/height" of two rasters are different (especially "pixel size" and "crs"). This is an expected result. That doesn't mean it is incorrect. Nov 8, 2020 at 12:26
  • I am not saying something is incorrect. All I would like to know is how to bring them into same raster size (pixel resolution) with rows and columns perfectly aligned (parallel and not skewed to each other) so that a statistical analysis can be performed.
    – GISEnthu
    Nov 8, 2020 at 12:35

1 Answer 1

2

There are two options: manually or automatically. The manual solution gives you more control and consists in reprojecting one of the rasters so that both rasters are in the same CRS. I would re-project the green raster (since it is in a geographic CRS, thus has units in degrees - in my opinion it's easier to understand a CRS with units in meters as your red raster).

To reproject right-click on the (green) rasters - export - save as - in the dialogue set the CRS to the same CRS as the red raster layer (EPSG:32610 in your case). Use the same pixel size as in the red raster (10,-10).

To automatically align your two rasters, use the function raster alignment, than also the offset in the grid is corrected and your pixels will be perfectly aligned - pixels form one raster fit exactly to the pixels of the other raster. See the QGIS documentation for this: https://docs.qgis.org/3.16/en/docs/user_manual/working_with_raster/raster_analysis.html#raster-alignment

4
  • 2
    If you re-project image to other CRS and pixel size you should also use the -tap option (target aligned pixels) of gdalwarp gdal.org/programs/gdalwarp.html#gdalwarp -tap (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent.
    – user30184
    Nov 8, 2020 at 10:46
  • @babel I tried your suggestion but the issue remains. I moved to UTM and exported the raster with pixel resolution close to the other raster at 10m but here are the issue remaining. 1) The rasters still have a skew between them. 2) The pixels are still not aligned. 3) The pixel value in the new raster changed quite a bit.
    – GISEnthu
    Nov 9, 2020 at 19:29
  • Did you try the raster alignment function? This should work
    – Babel
    Nov 9, 2020 at 20:25
  • What worked finally for me satisfying all my requirements was the "gdalwarp" function executed in the Ubuntu terminal (from the source directory): gdalwarp -t_srs EPSG:32610 -r cubic -tr 10 10 -te 728749.500 4364000.500 740349.500 4373200.500 Input.img Output.img. Here we have the georeferenced extent of the output file, "-te 728749.500 4364000.500 740349.500 4373200.500", the spatial reference "-t_srs EPSG:32610", the resampling method "-r cubic", and the output file resolution "-tr 10 10" (as per the units of the spatial reference, here it's UTM in metres).
    – GISEnthu
    Nov 10, 2020 at 9:56

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.