IGpValueTableObject vt = new GpValueTableObjectClass(); vt.SetColumns(2); vt.SetColumns(2); object weight; weight = 1 as object; object obj1 = fcBoundary; vt.AddRow(ref obj1); vt.SetValue(0, 1, ref weight); object obj2 = fcPairLine; vt.AddRow(ref obj2); vt.SetValue(1, 1, ref weight); parameters = new VarArrayClass(); parameters.Add(vt); parameters.Add("polyMerged"); gp.Execute("FeatureToPolygon_management", parameters, null);
Solved! Go to Solution.
Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor Dim vt = New ESRI.ArcGIS.Geoprocessing.GpValueTableObject Dim FC1 As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim FC2 As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim pLayer As ESRI.ArcGIS.Carto.ILayer2 Dim pFLayer As ESRI.ArcGIS.Carto.IFeatureLayer Dim params = New ESRI.ArcGIS.esriSystem.VarArray Try vt.SetColumns(1) pLayer = My.ArcMap.Document.FocusMap.Layer(0) pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer pFLayer = pLayer FC1 = pFLayer.FeatureClass pLayer = My.ArcMap.Document.FocusMap.Layer(1) pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer pFLayer = pLayer FC2 = pFLayer.FeatureClass vt.AddRow(FC1) vt.AddRow(FC2) params.Add(vt) params.Add("Polymerged") GP.Execute("FeatureToPolygon_management", params, Nothing) 'here's another way to do it. You have to add the ESRI.ArcGIS.DataManagementTools reference 'using the Add Reference dialog Dim F2P As New ESRI.ArcGIS.DataManagementTools.FeatureToPolygon F2P.in_features = vt F2P.out_feature_class = "poly1" GP.Execute(F2P, Nothing) Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString) End Try End Sub
Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor Dim vt = New ESRI.ArcGIS.Geoprocessing.GpValueTableObject Dim FC1 As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim FC2 As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim pLayer As ESRI.ArcGIS.Carto.ILayer2 Dim pFLayer As ESRI.ArcGIS.Carto.IFeatureLayer Dim params = New ESRI.ArcGIS.esriSystem.VarArray Try vt.SetColumns(1) pLayer = My.ArcMap.Document.FocusMap.Layer(0) pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer pFLayer = pLayer FC1 = pFLayer.FeatureClass pLayer = My.ArcMap.Document.FocusMap.Layer(1) pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer pFLayer = pLayer FC2 = pFLayer.FeatureClass vt.AddRow(FC1) vt.AddRow(FC2) params.Add(vt) params.Add("Polymerged") GP.Execute("FeatureToPolygon_management", params, Nothing) 'here's another way to do it. You have to add the ESRI.ArcGIS.DataManagementTools reference 'using the Add Reference dialog Dim F2P As New ESRI.ArcGIS.DataManagementTools.FeatureToPolygon F2P.in_features = vt F2P.out_feature_class = "poly1" GP.Execute(F2P, Nothing) Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString) End Try End Sub