QGIS – Merging Raster Creates BOX with No Data

gdal-mergegeotiff-tiffnodataqgisraster

I have 2 rasters. The first one is a lidar which is clipped by a masked layer. (30.53mb, pixel size=1m,float32)

enter image description here

The other is a local survey GEOTIFF. (75kb, pixel size=1m,float32)

enter image description here

When I merge them, QGIS makes a "box" with no data values. This is the command:

GDAL command:
gdal_merge.bat -a_nodata 0.0 -ot Float32 -of GTiff -o C:/Users/DELL/AppData/Local/Temp/processing_mciOFb/1182dffdfdad4287b941faacdf067b43/OUTPUT.tif –optfile C:/Users/DELL/AppData/Local/Temp/processing_mciOFb/268a4fe4705745a6817ebfd45e67ff3b/mergeInputFiles.txt

enter image description here

What am I missing?

I have done these things for many times and my first time to experience this.

Best Answer

The smaller raster was an output from the Raster Calculator and was not showing the correct extents (showing only positive results). The Raster Calculator produced a box/rectangular raster (including negative results).

This is the reason why there is a box when I merged the two rasters as it included the areas with negative values.

Related Question