Problem: IRasterGeometryProc::Merge produces empty raster output


When two rasters are merged using the IRasterGeometryProc::Merge functionality, and the result is used as input to another operation, such as creating a raster of slope, the resulting slope raster is filled with NoData values.


The returned raster object from the IRasterGeometryProc::Merge operation only holds band pointers. This means the pixel values are not written to the output raster. When attempting to use the raster object, it is not yet available, and thus the slope operation attempts to get information from data that is not there.

Solution or Workaround

Do not use the returned output raster object directly. Release the object (set the object to Nothing), reopen the merge result from the persisted file on disk, and continue to use the next operation on the persisted raster object.