AnsweredAssumed Answered

ArcGIS Pro SDK Raster Save Equivalent

Question asked by dfresh22 on Sep 30, 2020
Latest reply on Oct 2, 2020 by gkmieliauskas_cellexp

What is the equivalent of raster save using ArcGIS Pro SDK C#

Arcpy Code

in_raster = Raster('c:/data/inraster')
new_raster.save('c:/output/outraster1')

 

Given this example here - Executing Spatial Analyst Tools Using ArcGIS Pro SDK 

 

Typically you could just set the output raster in the Value Array, as done here

var valueArray = Geoprocessing.MakeValueArray(maExpression, outRaster);
var gpresult1 = await Geoprocessing.ExecuteToolAsync(RasterCalculator_sa, valueArray);

 

However that changes, if the tool you are running does not have an output raster that you can set. The CutFill Spatial Analyst returns a raster, but I would like to save that raster somewhere instead of using CopyRaster.

 

for example, Cut Fill (Spatial Analyst)—ArcGIS Pro | Documentation 

var valueArray = Geoprocessing.MakeValueArray(inputRasterOne, inputRasterTwo);
var gpresult1 = await Geoprocessing.ExecuteToolAsync(CutFill_sa, valueArray);

 

 

UPDATE

based on my friend's answer Gintautas Kmieliauskas,

the correct solution is to put the output raster in the value array.

 

For my example, I referenced ArcGIS 9.3 Cut Fill and followed the same and it worked.

var valueArray = Geoprocessing.MakeValueArray(inputRasterOne, inputRasterTwo, outputRaster);
var gpresult1 = await Geoprocessing.ExecuteToolAsync(CutFill_sa, valueArray);

Outcomes