I'm having a hard time substracting 2 raster with ArcObjects sdk 10.1. I keep getting a nullreference exception at the gp.execute() method, but I can't figure out where the problem is, I recall setting other arguments to nothing in the past so don't think this would be the problem
I'm using both raster paths in the expression and I'm not sure if the syntax will be correctly parsed
Input values are in this test method (don't mind the incomplete assert, I check it manually in ArcMap)
Public Sub RasterCalculatorTest_ObjectIsFiled_NotIsNothing() Dim target As CalculateOVRaster = New CalculateOVRaster() Dim rasterPath1 As String = rasterGdbPath & "\" & "subvakken_hpo" Dim rasterPath2 As String = dhmPath & "\" & dhmName Dim expression As String = "'" & rasterPath1 & "'-'" & rasterPath2 & "'" Dim outputPath As String = rasterGdbPath target.RasterCalculator(outputPath, expression) Assert.Inconclusive("") End Sub Main method:
Public Sub RasterCalculator(ByVal outputRasterPath As String, ByVal expression As String) Dim gp As GeoProcessor = New GeoProcessorClass Dim toolRasterCalc As New RasterCalculator(expression, outputRasterPath) gp.OverwriteOutput = True Dim gpResult As IGeoProcessorResult = New GeoProcessorResult gpResult = gp.Execute(toolRasterCalc.ToolboxName, Nothing, Nothing) End Sub Thanks in advance!
أكثر...
I'm using both raster paths in the expression and I'm not sure if the syntax will be correctly parsed
Input values are in this test method (don't mind the incomplete assert, I check it manually in ArcMap)
Public Sub RasterCalculatorTest_ObjectIsFiled_NotIsNothing() Dim target As CalculateOVRaster = New CalculateOVRaster() Dim rasterPath1 As String = rasterGdbPath & "\" & "subvakken_hpo" Dim rasterPath2 As String = dhmPath & "\" & dhmName Dim expression As String = "'" & rasterPath1 & "'-'" & rasterPath2 & "'" Dim outputPath As String = rasterGdbPath target.RasterCalculator(outputPath, expression) Assert.Inconclusive("") End Sub Main method:
Public Sub RasterCalculator(ByVal outputRasterPath As String, ByVal expression As String) Dim gp As GeoProcessor = New GeoProcessorClass Dim toolRasterCalc As New RasterCalculator(expression, outputRasterPath) gp.OverwriteOutput = True Dim gpResult As IGeoProcessorResult = New GeoProcessorResult gpResult = gp.Execute(toolRasterCalc.ToolboxName, Nothing, Nothing) End Sub Thanks in advance!
أكثر...