Spatial Join via IGeoProcessor

Discussion created by ansergis on Jul 20, 2012

I keep getting an error message with the following code. The error message is just generic but I suspect the problem is with the output feature class but I can't figure out exacltly what it is wanting for input (blank FClass, FClass with all the fields prepared?)

Any ideas / example code much appreciated :

            Dim TargetLayer As IFeatureLayer = New FeatureLayer
            TargetLayer.FeatureClass = pFClass

            Dim JoinLayer As IFeatureLayer = New FeatureLayer
            JoinLayer.FeatureClass = hchange_dFClass

            Dim JoinFeat As IFeatureClass = ws.CreateFeatureClass("JoinFeat", _fields, _uid, Nothing,  esriFeatureType.esriFTSimple, "SHAPE", "")
            'Dim JoinFeatObj As Object = New Object

            Dim ISJ As New SpatialJoin
            ISJ.join_features = JoinLayer
            ISJ.target_features = TargetLayer
            ISJ.out_feature_class = JoinFeat

            gptool.Execute(ISJ, Nothing)