In ae9.2, intersect between SHP data is implemented using ibasicgeoprocessor. intersect. Recently used in development, but the data in Geodatabase is entangled for a while for other reasons. The solution is as follows:
Intersection core of SHP dataCodeAs follows:
Ifeatureclassname pfeatclassname;
Pfeatclassname = new featureclassnameclass ();
Pfeatclassname. featuretype = esrifeaturetype. esriftsimple;
Pfeatclassname. shapefieldname = "shape ";
Pfeatclassname. shapetype = pinputfeatclass. shapetype;
// Workspace name
Iworkspacename pnewwsname;
Pnewwsname = new workspacenameclass ();
Pnewwsname. workspacefactoryprogid = "esrisponcesfile. shapefileworkspacefactory ";
Pnewwsname. pathname = system. Windows. Forms. application. startuppath + @ "\ Temp ";
// Dataset name
Idatasetname pdatasetname;
Pdatasetname = pfeatclassname as idatasetname;
Pdatasetname. Name = pinputfeatlayer. Name + "_ intersect" + datetime. Now. tostring ("yyyy-MM-dd_HH-mm-ss ");
Pdatasetname. workspacename = pnewwsname;
Double Tol = 0.1;
// Geometric processing
Ibasicgeoprocessor pbgp;
Pbgp = new basicgeoprocessorclass ();
Pbgp. spatialreference = axmapcontrol1.spatialreference;
Ifeatureclass poutputfeatclass;
Poutputfeatclass = pbgp. Intersect (pinputtable, false, poverlaytable, false, Tol, pfeatclassname );
Pay attention to the Code marked with red. The following two lines are modified:
To achieve the data intersection function in Geodatabase, change the two rows:
Pnewwsname. workspacefactoryprogid = "esrisponcesfile. accessworkspacefactory ";
Pnewwsname. pathname = "E: \ persondatabase. mdb ";
Experiment. Note that there are limits on the layer name in the database, so it is best not to be as long as SHP.