behrens

run merge tool with selected features

Discussion created by behrens on Apr 28, 2011
Hi,
i'm trying to execute a merge tool in my ArcGIS Engine Application.
I'm not able to specify the Input FeatuterLayers, so that only selected Features are merged.

I tried:
   ...
   Dim pParamInfo As ESRI.ArcGIS.esriSystem.IArray
   pParamInfo = m_GPTool.ParameterInfo
   Dim pParameter As IGPParameter
   Dim pParamEdit As IGPParameterEdit
   Dim pDataType As ESRI.ArcGIS.Geodatabase.IGPDataType
   'Input
   pParameter = pParamInfo.Element(0)
   pParamEdit = pParameter
   pDataType = pParameter.DataType
   Dim sInputFeatures As String = "'InputLayer1','InputLayer2'"
   pParamEdit.Value = pDataType.CreateValue(sInputFeatures)
   'Output
   pParameter = pParamInfo.Element(1)
   pParamEdit = pParameter
   pDataType = pParameter.DataType
   pParamEdit.Value = pDataType.CreateValue("OutputLayer")
   m_GPTool.Execute(pParamInfo, pTrackCancel, pGPEnvironmentManager, pGPMessages)
   'with m_GPTool as IGPTool is the MergeTool
   
AND
   ...
   Dim pMerge As ESRI.ArcGIS.DataManagementTools.Merge
   pMerge = New ESRI.ArcGIS.DataManagementTools.Merge
   pMerge.inputs = "'InputLayer1','InputLayer2'"
   pMerge.output = "OutputLayer"
   Dim GP As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New   ESRI.ArcGIS.Geoprocessor.Geoprocessor  
   GP.Execute(pMerge, Nothing)

I can't find a way to specify many FeatureLayers (as IFeatureLayer) and not FeatureLayerNames (as String) as InputParameter

This works with selected Features, but in_features is only one FeatureLayer:
   Dim pClip As ESRI.ArcGIS.AnalysisTools.Clip
   pClip = New ESRI.ArcGIS.AnalysisTools.Clip
   pClip.in_features = SelectedFeatureLayer
But Merge needs a List of FeatureLayers.

Help apreciated!

Outcomes