Dear helpers. I would like to built an application with Erase and Clip (I use ArcEngine with Vb.net). I try some code and my code can CLip but can not Erase, I don't know why. Would you please help me to correct code and explain me why? Thank you very much for helping.
Following are my codes. (I have attached data files)
Public Class MainForm Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click '==='Cliping=== Dim ClipTool As ESRI.ArcGIS.AnalysisTools.Clip = New ESRI.ArcGIS.AnalysisTools.Clip() ClipTool.in_features = "E:\Temp\Road.shp" 'axMapControl1.Map.Layer(0) ClipTool.clip_features = "E:\Temp\Boundary.shp" 'axMapControl1.Map.Layer(1) ClipTool.out_feature_class = "E:\Temp\clip_out.shp"
Dim gp_clip As Geoprocessor = New Geoprocessor Dim resultsClip As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult = CType(gp_clip.Execute(ClipTool, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)
'''''=>> ResultsCLip is a System.___Object
Dim EraseTool As ESRI.ArcGIS.AnalysisTools.Erase = New ESRI.ArcGIS.AnalysisTools.Erase EraseTool.in_features = "E:\Temp\Road.shp" ' axMapControl1.Map.Layer(0) EraseTool.erase_features = "E:\Temp\Boundary.shp" 'axMapControl1.Map.Layer(1) EraseTool.out_feature_class = "E:\Temp\Erase_out.shp" Dim gp_Erase As Geoprocessor = New Geoprocessor Dim resultsErase As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult = CType(gp_Erase.Execute(EraseTool, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)
'''''=>> ResultsErase is Nothing....Please why???
End Sub End Class '============== Ngo T GIS for Sustainable Development, Hanoi, Vietnam
My computer (the computer I use to build program) is installed ArcGIS Desktop Arcinfo and ArcInfo Workstation also. And I also tried using erase tool (ArcToolbox) in Arcmap and it work without any problems. Do you think that my code is not contain any logic error? I will try to find error from my license.