Query and modification of features in ArcGIS

Source: Internet
Author: User

Turn from Nimeila's answer ask C # ArcGIS engine to modify the properties of a selected feature, a single feature line

Rlalterfrm Rlalter =Newrlalterfrm (); Rlalter.showdialog ();stringAlterid =RLalter.textBox1.Text;stringALTERRP =RLalter.textBox2.Text;stringALTERC =rlalter.textbox3.text;axmapcontrol1.clearlayers (); Axmapcontrol1.refresh ();Try{    stringstrFileName = Application.startuppath +@"\ Data \roadlamp.mxd"; //load a map in a data view for query operations    if(Axmapcontrol1.checkmxfile (strFileName)) {axmapcontrol1.loadmxfile (strFileName); }    Else{MessageBox.Show ("wrong data path:"+strFileName); }}Catch(Exception ex) {MessageBox.Show ("Error01 in MainForm.cs"+Ex. Message);} Axmapcontrol1.refresh ();stringStrqk = Rlalter.getquerykey ();//Get Query Value//Find LayerIfeaturelayer Pfeaturelayer =NewFeaturelayer ();p Featurelayer= Axmapcontrol1.get_layer (0) asIfeaturelayer;//Find FeaturesIqueryfilter Pqueryfilter =Newqueryfilter ();p queryfilter.whereclause="[rl_id] = '"+ Strqk +"'"; Ifeaturecursor pfeaturecur= Pfeaturelayer. Search (Pqueryfilter,false); IFeature pfeature=NULL;p Feature=pfeaturecur.nextfeature ();if(NULL==pfeature) {MessageBox.Show ("I'm sorry! The element does not exist");}Else{ifields Pfields=Pfeature.fields;ifeatureclass Pfeatureclass=Pfeaturelayer.    Featureclass; //Modifying property values    intField1 = Pfields.findfield ("rl_id"); intField2 = Pfields.findfield ("RL_RP"); intfield3 = Pfields.findfield ("Rl_c");    Pfeature.set_value (field1, Alterid);    Pfeature.set_value (Field2, ALTERRP);    Pfeature.set_value (field3, ALTERC);    Pfeature.store (); MessageBox.Show ("modified successfully! ","Tips");}}

Query and modification of features in ArcGIS

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.