Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Raster Calculator Expression in C#

$
0
0
I'm trying to use the RasterCalculator in C# (I'm not using python)

string slopeRadiansRasterFilePath = Path.Combine(_options.OutputTmpWorkspaceName, "SlopeRadians");
string formula = ('C:\Workspace\ForestGrids\R03\0310_SantaFe_smallTest\test\NnDemRasters.gdb\Elev' * 1.570796) / 90;

RasterCalculator rasterCalc = new RasterCalculator();
rasterCalc.expression = formula;
rasterCalc.output_raster = slopeRadiansRasterFilePath;

Every time I run it I get a HRESULT error.

I can use the GP tool menu interface with the same raster and formula and it works fine. Any ideas on what the format of the expression should be? I've tried several different variations with single quotes, double quotes, square brackets, etc.

Viewing all articles
Browse latest Browse all 1374

Trending Articles