Application of MDB data in the ibasicgeoprocessor. intersect method

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.