Running SurfaceVolume multiple times

545
2
01-17-2011 07:32 AM
MatthewBuchanan
New Contributor III
I am running the geoprocessing tool SurfaceVolume (in 3D analyst toolbar) from Visual Studio 2010.

            ' Create the Geoprocessor object
            Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult
            Dim geoProcTool As SurfaceVolume = New SurfaceVolume
            geoProcTool.in_surface = strDEM
            geoProcTool.out_text_file = strOutputFile
            geoProcTool.reference_plane = strReferencePlane
            geoProcTool.base_z = dblPlaneHeight
            geoProcTool.z_factor = dblZfactor

            ' Start from top elevation, go down by interval to lower plane
            Do While dblPlaneHeight > dblLowerPlane
                ' run process: Surface Volume...
                Result = RunTool(geoProcTool, Nothing)
                ' Increment plane height by interval
                dblPlaneHeight -= dblInterval
                intRows += 1
            Loop


This was working with 9.3.1, but when I upgraded to 10 after the first time through the loop it complained that strOutputFile already exists and won't append to the file like it is supposed to. I thought maybe that the tool changed at 10, but it doesn't seem to have any extra parameters.

Is there a way to turn an overwrite setting on somewhere?

I'm running ArcGIS 10 on MS Windows Server 2008 R2.
0 Kudos
2 Replies
JohnHauck
Occasional Contributor II
The Geoprocessor class has an overwriteoutput property: OverwriteOutput
0 Kudos
MatthewBuchanan
New Contributor III
Thanks John. I will try using that settings. In the meantime I created this convoluted workaround where I create a whole bunch of text files, they all have headers, read the second line and then append that to a new file. Quite a pain but it worked. When I get the chance I'll re-code it to make it simpler. 😄
0 Kudos