ArcGIS Pro SDK Raster Save Equivalent

530
1
Jump to solution
09-30-2020 12:56 PM
DouglasLong
Occasional Contributor

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);‍‍‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi Douglas,

The same situation is with Euclidean distance geoprocessing tool. Look at this how I do in that case:

https://community.esri.com/thread/245178-when-will-net-developers-get-api-reference-for-all-geoproce...

View solution in original post

0 Kudos
1 Reply
GKmieliauskas
Esri Regular Contributor

Hi Douglas,

The same situation is with Euclidean distance geoprocessing tool. Look at this how I do in that case:

https://community.esri.com/thread/245178-when-will-net-developers-get-api-reference-for-all-geoproce...

0 Kudos