Geoprocessing with Geometry

Discussion created by warpengine on Mar 23, 2018
Latest reply on Mar 29, 2018 by warpengine

I am struggling to get an GP tool to work with Geometry. 


What I do is create an IPolygon object through .NET code. All that works great except sometimes the results have slivers. So it looks like the Integrate tool could help me here. Again I have an IPolygon object and am not creating any feature classes on disk. I will draw the polygon to the screen and that is it.


So I try this:

'use the Integrate tool to get rid of slivers
Dim gp As Geoprocessor = New Geoprocessor
gp.OverwriteOutput = True
gp.AddOutputsToMap = False
Dim intgGeom As Integrate = New Integrate
intgGeom.in_features = pClonePolygon 'the input polygon
intgGeom.cluster_tolerance = "2 Meters" 'set the XYTolerance to 2 Meters
gp.Execute(intgGeom, Nothing)

No cigar. I get this exception:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in ESRI.ArcGIS.Geoprocessor.dll
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.

According to this help page all GP tools should work with geometry: Using geometry objects with geoprocessing tools—Help | ArcGIS Desktop So what am I doing wrong here?