lwu1

Error in Using Integrate Tool in Geoprocessing

Discussion created by lwu1 on Nov 29, 2012
Hello everyone,

I run into error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." when I use Integrate tool as follows:


   Public Sub Clean(ByVal inputShapefilePath As String, ByVal maxWidth As Double, ByVal maxWidthUnit As String)
         Dim geoprocessor As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor()
        '        geoprocessor.OverwriteOutput = True

        Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass
        Dim workspace As ESRI.ArcGIS.Geodatabase.IWorkspace = workspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(inputShapefilePath), 0)
        Dim featureWorkspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = CType(workspace, ESRI.ArcGIS.Geodatabase.IFeatureWorkspace) ' Explict Cast
        Dim featureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = featureWorkspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(inputShapefilePath))

        'create a new instance of a integrate tool
        Dim integrateTool As New Integrate(featureClass)

        '        integrateTool.cluster_tolerance = CStr(maxWidth) & " " & maxWidthUnit
         'Run integrate tool
        geoprocessor.Execute(integrateTool, Nothing)
    End Sub

Thanks for any help,

Some additional info:
1. The polygon shapefile should be fine since I can add it into ArcMap and the Integrate tool in ArcMap's toolbox works fine on it;
2. I'm using ArcGIS 10.1 on Windows 7

Outcomes