Hello all
Some GP tools does not have a output parameter but return some kind of objects that should be saved after.
Many of the sa commands (for example Abs—Help | ArcGIS Desktop ) return a value that must be saved.
After I run var result = Geoprocessing.ExecuteToolAsync(...) How do I make me result permanent?
Thanks
Hi Mody,
Look at the piece of code below that return minimum value of specific table field. I hope it will help.
var parameters = Geoprocessing.MakeValueArray(pFeatClass, string.Format("[[{0}, MIN]]", sAreaField));
var gpResult = Geoprocessing.ExecuteToolAsync("Statistics_analysis", parameters);
double dMin = Convert.ToDouble(gpResult.Result.Values[0]);
That works for number outputs, but how can you save a raster output?
Hi Ben,
You need to check the type of your output. Try to cast to Raster. If it is Raster then use SaveAs method.
If it is string then open it as Raster and use SaveAs method.
Thanks. I was able to get the string of the raster storage path. I did not realise that these tools generated the raster results in the scratch workspace with an arbitrary name.
...for large output you may want to rather use your output workspace in place of the scratch workspace so that save will internally do a rename rather than a copy.