7

I have two raster A and B. A and B have the same grid size but different extent.

How can I make A have the same number of columns and rows, as well as the spatial extent of B?

5

Depending upon which platform you are using, with Arc you need to ensure, before clipping, that you set your Environment Settings: Geoprocessing>Environments... Set both Processing Extent and Raster Analysis to the extent of the layer to which you wish to clip, and set also your Cell Size to the cell size of the clip raster(not the input raster).

In QGIS use GRASS plugin thru Sextante would be the quickest way, alternatively do directly through GRASS.

Source: Advanced GIS graduate course taken last year, heaps of raster experience.

2

ArcMap Data Management Tools > Raster > Raster Processing > Clip should do it. However I found that sometimes, if the grid cells of the raster do not overlap perfectly, i.e. the two rasters are not perfectly georeferenced, Clip might retrieve a result with a slightly different number of columns and rows, generally a difference of 1. For instance, if the extent of raster A is desired to be the same as B, e.g. 20 x 20, Clip might return a raster of 20 x 21. Using the Georeferencing toolbar to perfectly georeference the images might help. Also, as Bryce Touchstone suggested, I found Geoprocessing environment is very helpful, and I also recommend filling in the Snap Raster dropdown menu with the relevant dataset.

1

Clip raster A by B using the Clip (Data Management) tool under Data Management - Raster - Raster processing.

1

If you have a single band raster, a very quick and easy approach using QGIS is simply to use the Raster Calculator, set the expression as your band of interest (e.g. BandA) and then using the 'Current layer extent' button to set the extents to a different band (e.g. BandB)enter image description here

0

To maintain the same cell alignment, you can use the option in "Snap Raster" in environment setting

enter image description here

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.