博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ArcGIS 中要素的查询与修改
阅读量:4561 次
发布时间:2019-06-08

本文共 1532 字,大约阅读时间需要 5 分钟。

转自的回答

 

RLAlterFrm RLalter = new RLAlterFrm();RLalter.ShowDialog();string AlterID = RLalter.textBox1.Text;string AlterRP = RLalter.textBox2.Text;string AlterC = RLalter.textBox3.Text;axMapControl1.ClearLayers();axMapControl1.Refresh();try{    string strFileName = Application.StartupPath + @"\数据\Roadlamp.mxd";    //在数据视图中加载地图,供查询操作    if (axMapControl1.CheckMxFile(strFileName))    {        axMapControl1.LoadMxFile(strFileName);    }    else    {        MessageBox.Show("错误的数据路径:" + strFileName);    }}catch (Exception ex){    MessageBox.Show("Error01 in MainForm.cs" + ex.Message);}axMapControl1.Refresh();string strQK = RLalter.getQueryKey();//获取查询值//找到图层IFeatureLayer pfeaturelayer = new FeatureLayer();pfeaturelayer = axMapControl1.get_Layer(0) as IFeatureLayer;//找到要素IQueryFilter pQueryFilter = new QueryFilter();pQueryFilter.WhereClause = "[RL_ID] = '" + strQK + "'";IFeatureCursor pFeatureCur = pfeaturelayer.Search(pQueryFilter, false);IFeature pFeature = null;pFeature = pFeatureCur.NextFeature();if (null == pFeature){    MessageBox.Show("对不起!该元素不存在");}else{    IFields pFields = pFeature.Fields;IFeatureClass pFeatureClass = pfeaturelayer.FeatureClass;    //修改属性值     int field1 = pFields.FindField("RL_ID");    int field2 = pFields.FindField("RL_RP");    int field3 = pFields.FindField("RL_C");    pFeature.set_Value(field1, AlterID);    pFeature.set_Value(field2, AlterRP);    pFeature.set_Value(field3, AlterC);    pFeature.Store();    MessageBox.Show("修改成功!","提示");}}

 

转载于:https://www.cnblogs.com/arxive/p/6322023.html

你可能感兴趣的文章
spark-2.2.0安装和部署——Spark集群学习日记
查看>>
ZOJ FatMouse' Trade 贪心
查看>>
音乐播放器
查看>>
SQL COOKBOOK (Ch.1-10)
查看>>
创建数组
查看>>
dict使用
查看>>
[转] 移动平台Html5的viewport使用经验
查看>>
ASP.NET MVC的帮助类HtmlHelper和UrlHelper
查看>>
《Python数据科学手册》第五章机器学习的笔记
查看>>
ubuntu16.04 配置爬虫环境
查看>>
Centos7,PHP7安装swoole
查看>>
02_ListActive中响应事件 并LogCat输出
查看>>
doubleclick adx note
查看>>
Celery框架
查看>>
[c#]asp.net开发微信公众平台(4)关注事件、用户记录、回复文本消息
查看>>
[转载,感觉写的非常详细]DUBBO配置方式详解
查看>>
linux Valgrind使用说明-内存泄漏
查看>>
Android在Eclipse上的环境配置
查看>>
Page Object 设计模式介绍
查看>>
全局变量报错:UnboundLocalError: local variable 'l' referenced before assignment
查看>>