实现Identify功能

ArcEngine点选属性

ESRI.ArcGIS.Geometry.Point point = new ESRI.ArcGIS.Geometry.Point();
                point.X = e.mapX; //在axMapControl_OnMouseDown事件中

                point.Y = e.mapY;
                Geometry = point as IGeometry;
                axMapControl1.Map.SelectByShape(Geometry, null, true);
                axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); //选中要素高亮显示
                ILayer layer = axMapControl1.Map.get_Layer(0);  //获取layer,这里只有一个图层所以直接写了
                IMap map = axMapControl1.Map;

                IFeatureLayer FeatureLayer = layer as IFeatureLayer;

                IFeatureSelection featureSelection;
                featureSelection = FeatureLayer as IFeatureSelection;
                long id = featureSelection.SelectionSet.IDs.Next(); //获取选中要素的ID值。


                IFeatureClass featureClass=FeatureLayer.FeatureClass;

                IQueryFilter queryFilter = new QueryFilterClass();  //创建一个查询筛选
                queryFilter.WhereClause = "OBJECTID =" + id;   //查询条件,即选中获取的ID
                queryFilter.SubFields = "SHAPE_Area";  
                int fieldPosition = featureClass.FindField("SHAPE_Area");   //获取字段(这里是SHAPE_Area),其他字段同理
                IFeatureCursor featureCursor = featureClass.Search(queryFilter, true); 
                IFeature feature = null;  
                while ((feature = featureCursor.NextFeature()) != null)
                {
                    MessageBox.Show(feature.get_Value(fieldPosition).ToString());  //获取字段的值。
                }




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值