1 / 18

南阳师范学院环境资源与地理信息实验教学示范中心

南阳师范学院环境资源与地理信息实验教学示范中心. 组件式 GIS 软件开发. 实验五 GIS 分析. 内容概要. 实验目的 实验原理 实验步骤 结果分析 思考及讨论 课外练习. 实验目的. 了解 ArcGIS Engine 关于 GIS 分析功能的组成及结构。 掌握使用 GIS 分析组件进行基本查询、分析功能的实现方法。 熟悉并练习掌握与 GIS 分析相关的组件功能及使用方法。 继续熟练和掌握基于 ArcGIS Engine 进行二次开发的方法和技能。. 实验预习.

moswen
Télécharger la présentation

南阳师范学院环境资源与地理信息实验教学示范中心

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 南阳师范学院环境资源与地理信息实验教学示范中心南阳师范学院环境资源与地理信息实验教学示范中心 组件式GIS软件开发 实验五 GIS分析

  2. 内容概要 • 实验目的 • 实验原理 • 实验步骤 • 结果分析 • 思考及讨论 • 课外练习

  3. 实验目的 • 了解ArcGIS Engine关于GIS分析功能的组成及结构。 • 掌握使用GIS分析组件进行基本查询、分析功能的实现方法。 • 熟悉并练习掌握与GIS分析相关的组件功能及使用方法。 • 继续熟练和掌握基于ArcGIS Engine进行二次开发的方法和技能。

  4. 实验预习 • GIS空间分析是地理信息系统软件的基本功能之一,是基于地理对象的位置和形态特征的空间数据分析技术,其目的在于提取和传输空间信息,这是地理地理信息系统区别于一般信息系统的主要功能特征。 • 空间分析根据使用的数据性质不同,可以分为:(1)基于空间图形数据的分析运算;(2)基于非空间属性的数据运算;(3)空间和非空间数据的联合运算。 • 基本的空间分析功能包括空间关系运算、空间拓扑运算、空间查询、缓冲区分析、叠加分析和网络分析等。

  5. 实验原理 • 空间分析是基于地理对象的位置和形态特征的空间数据分析技术,其目的在于提取和传输空间信息。 • 本实验主要介绍空间查询和拓扑分析。 • ArcGIS Engine提供了数据查询相关组件,如QueryDef和Cursor对象等。对于拓扑操作,在Envelope类、Multipoint类、Point类等类中都实现了ITopologicalOperator接口,可以进行拓扑操作。

  6. 实验原理 • ArcGIS Engine数据查询组件结构

  7. 实验原理 ArcGIS中的多种空间关系

  8. 实验原理 ArcGIS中的多种拓扑操作

  9. 实验数据 • 使用本课程实验使用的数据,包括居民区、道路和学校。

  10. 实验步骤 • (1) 在Visual Studio 2010建立新的ArcGIS Engine工程,在界面中添加控件如下:

  11. 实验步骤 • (2) 实现GIS分析功能。代码如下: • //加载地图文档 • private void loadMapDocument() • { • System.Windows.Forms.OpenFileDialog openFileDialog; • openFileDialog = new OpenFileDialog(); • openFileDialog.Title = "打开地图文档"; • openFileDialog.Filter = "map documents(*.mxd)|*.mxd"; • openFileDialog.ShowDialog(); • string filePath = openFileDialog.FileName; • if (axMapControl1.CheckMxFile(filePath)) • { • axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass; • axMapControl1.LoadMxFile(filePath, 0, Type.Missing); • axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault; • } • else • { • MessageBox.Show(filePath + "不是有效的地图文档"); • } • }

  12. 实验步骤 • //获取颜色对象 • private IRgbColor getRGB(int r, int g, int b) • { • IRgbColor pColor; • pColor = new RgbColorClass(); • pColor.Red = r; • pColor.Green = g; • pColor.Blue = b; • return pColor; • } • //获取简单线符号 • private ISymbol getSimpleLineSymbol() • { • ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass(); • simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot; • simpleLineSymbol.Width = 10; • IRgbColor rgbColor = getRGB(255, 0, 0); • simpleLineSymbol.Color = rgbColor; • ISymbol symbol = simpleLineSymbol as ISymbol; • symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; • return symbol; • }

  13. 实验步骤 • //获取简单面填充符号 • private ISimpleFillSymbol getSimpleFillSymbol(int fillColor,int lineColor) • { • ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass(); • simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; • simpleFillSymbol.Color = getRGB(fillColor, 0, 0); • //创建边线符号 • ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass(); • simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot; • simpleLineSymbol.Color = getRGB(0, lineColor, 0); • simpleLineSymbol.Width = 5; • ISymbol symbol = simpleLineSymbol as ISymbol; • symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; • simpleFillSymbol.Outline = simpleLineSymbol; • return simpleFillSymbol; • } • 其它符号显示等功能根据开发帮助自己练习实现。

  14. 实验步骤 • 实现Union操作 • //Union • private void button10_Click(object sender, EventArgs e) • { • IFeatureLayer featureLayer = this.axMapControl1.Map.get_Layer(1) as IFeatureLayer; • IFeature feature; • IActiveView activeView = this.axMapControl1.ActiveView; • ITopologicalOperator topo; • IGeometry geometry; • feature = featureLayer.FeatureClass.GetFeature(0); • topo = feature.Shape as ITopologicalOperator; • IEnvelope env = feature.Shape.Envelope; • double width, height; • width = env.XMax - env.XMin; • height = env.YMax - env.YMin; • object Missing = Type.Missing; • IPolygon polygon = new PolygonClass(); • IPointCollection pointCollection = polygon as IPointCollection; • IPoint point = new PointClass(); • point.PutCoords(env.XMin + width / 3, env.YMin + height / 3); • pointCollection.AddPoint(point, ref Missing, ref Missing); • point.PutCoords(env.XMin + width / 3, env.YMax - height / 3); • pointCollection.AddPoint(point, ref Missing, ref Missing);

  15. 实验步骤 • point.PutCoords(env.XMax + width / 3, env.YMax - height / 3); • pointCollection.AddPoint(point, ref Missing, ref Missing); • point.PutCoords(env.XMax + width / 3, env.YMin + height / 3); • pointCollection.AddPoint(point, ref Missing, ref Missing); • polygon.SimplifyPreserveFromTo(); • geometry = topo.Union (polygon as IGeometry); • ISimpleFillSymbol simpleFillSymbol = getSimpleFillSymbol(255,255) ; • activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache); • activeView.ScreenDisplay.SetSymbol(simpleFillSymbol as ISymbol); • activeView.ScreenDisplay.DrawPolygon(geometry as IGeometry); • activeView.ScreenDisplay.FinishDrawing(); • } • } • 其它空间操作由自己练习实现。

  16. 结果分析 • 运行程序即可以选择地图文档,加载地图文档后可以选择多种空间分析方式进行分析效果和功能的观察。 • 重点查看多种空间操作的效果及多种符号化方式的显示效果。

  17. 思考及讨论 • 如果对拓扑分析的结果同时进行空间查询和选择操作该如何进行? • 空间统计操作该如何实现?

  18. 课外练习 • 分别实现基于属性选择功能和基于空间的选择功能。 • 复习及总结GIS分析相关功能的体系结构和实现方法。

More Related