AE + C # implement merge, and AE implement merge of the same structure layers C # code

Source: Internet
Author: User

AE + C # merge implementation

Ilayer player;
Ifeaturelayer pfeaturelayer;
Ifeatureclass pfeatureclass;
Iworkspacename pnewwsname;
Ibasicgeoprocessor pbasicgeop;
Ifeatureclassname pfeatureclassname;
Idatasetname pdatasetname;
Ifeatureclass poutputfeatclass;
Ifeaturelayer poutputfeatlayer;
Iarray parray;
Itable ptable;
// Merge the set of Layers
Parray = new arrayclass ();
For (INT I = 0; I <this. axmapcontrol1.layercount; I ++)
Player = This. mapc_main.get_layer (I );
Parray. Add (player );
// Define the fields table of the output layer
Player = This. mapc_main.get_layer (0 );
Ptable = (itable) player;
Pfeaturelayer = (ifeaturelayer) player;
Pfeatureclass = pfeaturelayer. featureclass;
// Determine whether there are more than two layers
If (this .. axmapcontrol1.layercount <2 ){
MessageBox. Show ("Table Qi failed ");
// Output file type
Pfeatureclassname = new featureclassnameclass ();
Pfeatureclassname. featuretype = esrifeaturetype. esriftsimple;
Pfeatureclassname. shapefieldname = "shape ";
Pfeatureclassname. shapetype = pfeatureclass. shapetype;
// Output the shapefile name and position
Pnewwsname = new workspacenameclass ();
Pnewwsname. workspacefactoryprogid = "esrisponcesfile. shapefileworkspacefactory ";
Pnewwsname. pathname = "E: \ cshape ";
Pdatasetname = (idatasetname) pfeatureclassname;
Pdatasetname. Name = "union_result_1 ";
Pdatasetname. workspacename = pnewwsname;

// Merge Layers
Pbasicgeop = new basicgeoprocessorclass ();
Poutputfeatclass = pbasicgeop. Merge (parray, ptable, pfeatureclassname );
// Add the output layer to the map
Poutputfeatlayer = new featurelayerclass ();
Poutputfeatlayer. featureclass = poutputfeatclass;
Poutputfeatlayer. Name = poutputfeatclass. aliasname;
This .. axmapcontrol1.addlayer (poutputfeatlayer as ilayer, 0 );

From: Tid = 27749 & extra = Page % 3d3

TheWorkspacefactoryprogidIdentifies the progid of the workspacefactory object that is used to open that participant workspace.

Here is a list of some of the possible workspacefactoryprogids:

    • Esridatasourcesgdb. accessworkspacefactory
    • Esristmcesfile. arcinfoworkspacefactory
    • Esristmcesfile. cadworkspacefactory
    • Esridatasourcesgdb. filegdbworkspacefactory
    • Esridatasourcesoledb. oledbworkspacefactory
    • Esristmcesfile. pccoverageworkspacefactory
    • Esridatasourcesraster. rasterworkspacefactory
    • Esridatasourcesgdb. sdeworkspacefactory
    • Esridatasourcesfile. shapefileworkspacefactory
    • Esridatasourcesoledb. textfileworkspacefactory
    • Esristmcesfile. tinworkspacefactory
    • Esristmcesfile. vpfworkspacefactory


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: 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.