AnsweredAssumed Answered

IBasicGeoprocessor error

Question asked by usman.jamil on May 15, 2012
Latest reply on May 16, 2012 by Hornbydd
Hello Every one, i am using the code below to find the intersection of two layers.  I'm getting an error (screen shot attached here with) while executing the GP tool. can any one help me with it of what this error is about??


            IMap pMap = axMapControl1.Map;
            ILayer pLayer1 = pMap.get_Layer(0);
            IFeatureLayer pFeatureLayer1 = (IFeatureLayer)pLayer1;
            IFeatureClass pFeatureClass1 = pFeatureLayer1.FeatureClass;

            ILayer pLayer2 = pMap.get_Layer(1);
            IFeatureLayer pFeatureLayer2 = (IFeatureLayer)pLayer2;
            IFeatureClass pFeatureClass2 = pFeatureLayer2.FeatureClass;

            IWorkspaceName pNewWSName;
            IFeatureClassName pFeatClassName;
            IDatasetName pDatasetName;
            pFeatClassName = new FeatureClassNameClass();
            pDatasetName = (IDatasetName)pFeatClassName;
            pNewWSName = new WorkspaceNameClass();
            pNewWSName.WorkspaceFactoryProgID = "esriCore.ShapeFileWorkspaceFactory";
            pNewWSName.PathName = "D:\\Usman";
            pDatasetName.WorkspaceName = pNewWSName;
            pDatasetName.Name = "Intersect_result";
            //pFeatClassName.FeatureType = esriFeatureType.esriFTSimple;
            //pFeatClassName.ShapeType = esriGeometryType.esriGeometryAny;
            //pFeatClassName.ShapeFieldName = "Shape";

            IBasicGeoprocessor pBGP;
            IGeoProcessor pGP;
            double tol = 0;
            IFeatureClass pOutputFC;
            pBGP = new BasicGeoprocessorClass();

            pOutputFC = pBGP.Intersect(pFeatureClass1 as ITable, false, pFeatureClass2 as ITable, false, tol, pFeatClassName);

Best Regards,

Usman Jamil

Attachments

Outcomes