怎么用arcgis engine

怎么用arcgis engine,第1张

首先,在 "开始"——>"所有程序"中找到安装在本地的链接

然后,选择“Building stand-alone applications”或"Using the Winforms ArcGIS engine controls"。

首先查询点坐标的位置要素,然后根据空间查询分析,进行查询县要素上的名称

具体代码如下:

IPoint point = new PointClass()

point.X = 94.82//你要查询的点坐标位置

point.Y = 32.61//你要查询的点坐标位置

ISpatialFilter spatialFilter = new SpatialFilterClass()

spatialFilter.Geometry = (point as IPoint) as IGeometry//设置用于筛选几何对象

spatialFilter.GeometryField = "Shape"//设置筛选几何字段

spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects//设置空间几何关系

IFeatureLayer featureLayer = this.axMapControl1.Map.get_Layer(0) as IFeatureLayer//县的图层

IFeatureCursor featureCursor = null

featureCursor = featureLayer.FeatureClass.Search(spatialFilter, false)

IFeature feature = null

feature = featureCursor.NextFeature()

while (feature != null)

{

string strName = feature.get_Value(feature.Fields.FindField("NAME")).ToString()//你要查询的县的名称

feature = featureCursor.NextFeature()

}

System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor)

你的

IfeatureLayer

是null,然后你定义一个IFeatureLayer对象,将IfeatureLayer

给它,也就是说,

featureLayer

是个空对象,你这儿又直接用空对象,所以报错


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11281324.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存