Access and modification of layer paths in arcengine

Source: Internet
Author: User
Access and modification of layer paths in arcengine

(11:18:48)

Reprinted
Tags:

Modify the arcengine path to access it
Category:Development

When a layer can be accessed normally, you can obtain the data source path of the layer as follows:

Ifeature pfeaturelayer = (ifeaturelayer) player;
Ifeature fc = (ifeatureclass) pfeaturelayer. featureclass;
FDS = (ifeaturedataset) FC. featuredataset;
Ws = (iworkspace) FDS. workspace;
String S = ws. pathname. toupper ();

When the layer cannot be accessed normally and the data source needs to be repaired, the ifeatureclass obtained in the above method is empty. In this case, you can obtain the data source path of the layer in the following way:
Idatalayer pdlayer = (idatalayer) player;
Iworkspacename Ws = (idatasetname) (pdlayer. javascename). workspacename;
This. textbox2.text = ws. pathname;

Data Source modification method

1. filegdb
Idatalayer2 pdlayer = (idatalayer2) pflayer;
Idatasetname pdsname = (idatasetname) (pdlayer. CENAME );
Iworkspacename Ws = pdsname. workspacename;
This. textbox2.text = ws. pathname;
String newpath = @ "J: \ work \ windowsapplication1 \ windowsapplication1 \ bin \ new. GDB ";
WS. workspacefactoryprogid = "esrisponcesgdb. filegdbworkspacefactory ";
WS. pathname = newpath;
Pdsname. workspacename = ws;
Pmapdocument. Save (True, true );

2. SHP File
Idatalayer2 pdlayer = (idatalayer2) pflayer;
Idatasetname pdsname = (idatasetname) (pdlayer. CENAME );
Iworkspacename Ws = pdsname. workspacename;
This. textbox2.text = ws. pathname;
String newpath = @ "J: \ work \ windowsapplication1 \ windowsapplication1 \ bin \";
WS. pathname = newpath;
Pdsname. workspacename = ws;
Pmapdocument. Save (True, true );

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.