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.
Asked
Active
Viewed 239 times
2 Answers
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
GeoMonkey
- 1,357
- 11
- 26
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).
There is a Fill Value option which fills the outside of smaller raster by the user defined value (coincidentally, default value is 0.0).
Kazuhito
- 30,746
- 5
- 69
- 149


extentvariable in the environment settings should be enough. For examplearcpy.env.extent = 'Raster2.tif'– Marcelo Villa Mar 30 '18 at 17:32RasterCalculatorworks but the output cointains NoData values instead of 0's. I guess you could read your raster as aNumPyarray and then mask the NoData with 0's. – Marcelo Villa Mar 30 '18 at 17:50ApplyEnvironmenttool keeps multiple bands when used. – Marcelo Villa Mar 31 '18 at 01:45