I tried using the paths you have mentioned, but I got the same error again.
Which version of ArcGIS?Just from a cursory look I'm wondering if your paths should be: rasterCalc.expression = "D:\NewFolder\Raster1.tif" + " + " + "D:\NewFolder\Raster2.tif"; rasterCalc.output_raster = "D:\NewFolder\Raster3.tif"; Your expression is simple enough you may want to use the Plus tool. That would likely avoid some complications from accessing this functionality from .NET.
rasterCalc.expression = "D:\NewFolder\Raster1.tif" + " + " + "D:\NewFolder\Raster2.tif"; rasterCalc.output_raster = "D:\NewFolder\Raster3.tif";
Hi,I wanted to add the height information of two rasters and create another raster using the raster calculator. In Desktop Raster Calculator Tool the expression for the Same is like this - "Raster1" + "Raster2".I was trying to implement the same through coding in ArcGIS Engine using a Geoprocessing tool.The code snippet is as follows:Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true; RasterCalculator rasterCalc = new RasterCalculator(); rasterCalc.expression = " '@D:\NewFolder:\Raster1.tif" + "+" + "@D:\NewFolder:\Raster2.tif' "; rasterCalc.output_raster = "@D:\NewFolder:\Raster3.tif"; gp.Execute(rasterCalc,null);This is not getting executed and throws an error: HRESULT E_FAIL has been returned from a call to a COM component.
Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true; RasterCalculator rasterCalc = new RasterCalculator(); rasterCalc.expression = " '@D:\NewFolder:\Raster1.tif" + "+" + "@D:\NewFolder:\Raster2.tif' "; rasterCalc.output_raster = "@D:\NewFolder:\Raster3.tif"; gp.Execute(rasterCalc,null);
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.