4

I have two 8bit unsigned integer 4-band raster images that overlap (Raster 1 and Raster 2). One of the images is slightly smaller than the other (Raster 1). How can I extend the extent of the smaller raster (Raster 1) to match the extent of the larger raster (Raster 2)? The extended area in Raster 1 should contain 0 values for all the bands. NoData values are not wanted in this case. I use ArcGIS/Spatial Analyst, QGIS and any open source tools.

enter image description here

  • What are you going to do with the rasters when they have the same size? – Marcelo Villa Mar 30 '18 at 17:25
  • @MarceloVilla Tile them. – Aaron Mar 30 '18 at 17:30
  • Setting the extent variable in the environment settings should be enough. For example arcpy.env.extent = 'Raster2.tif' – Marcelo Villa Mar 30 '18 at 17:32
  • @MarceloVilla Setting the environment for which tool? – Aaron Mar 30 '18 at 17:34
  • Do you use gdalwarp? – Nathan Thomas Mar 30 '18 at 17:36
1

You can use gdalwarp, such as:

gdalwarp -of GTiff -te minx miny maxx maxy input.tif output.tif

You can get the extents using:

gdalinfo reference.tif
0

Hopefully Orfeo ToolBox is also on your list, of which Superimpose function fits smaller raster (your Raster 1) to a larger raster (your Raster 2).

(Allow me to show it in Monteverdi GUI, as I am not good at using it in QGIS processing - OTB mode).

enter image description here

There is a Fill Value option which fills the outside of smaller raster by the user defined value (coincidentally, default value is 0.0).

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.