I am trying to send multiples input features to the Geoprocessing.IGeoProcessor (to do an Intersect). I am doing this because I can't add the layer path since one of them is from ArcSDE. The example on the ESRI website is incomplete:
Building a custom geoprocessing function tool
[VB.NET]
' Multivalue parameter of Feature Layers/Feature Classes.'
Dim inputParameter As IGPParameterEdit3 = New GPParameterClass()
Dim inputType As IGPDataType = New GPFeatureLayerTypeClass()
Dim mvType As IGPMultiValue = New GPMultiValueClass()
mvType.MemberDataType = inputType
Dim mvValue As IGPMultiValue = New GPMultiValueClass()
mvValue.MemberDataType = inputType
inputFeatures.Name = "input_features"
inputFeatures.DisplayName = "Input Features"
inputFeatures.ParameterType = esriGPParameterType.esriGPParameterTypeRequired
inputFeatures.Direction = esriGPParameterDirection.esriGPParameterDirectionInput
inputFeatures.DataType = CType(mvType, IGPDataType)
inputFeatures.Value = CType(mvValue, IGPValue)
parameters.Add(inputFeatures)
There is no code to actually add the feature layer to the input features list. I tried to add my feature layer with :
mvValue.AddValue(lFeatureLayer)
and I got a invalid COM interface cast exception. What is the real way to do this?
1 Answer 1
If you want to create a new geoprocessing tool like in your example, then you do not add the layer yourself. This is doing the tool for you during running it.
But I think you want to consume an already existing tool (like intersect). This is explained in How to run a geoprocessing tool
-
I ended up doing something else because it doesn't work. Like I said, I must use the IfeatureLayer object because I can't use a path for ArcSDE. Anyway, I don't need an answer anymore. Thanks!Math– Math2016年10月20日 15:31:03 +00:00Commented Oct 20, 2016 at 15:31