返回首页
当前位置: 主页 > 网络编程 > 其他实例教程 >

ArcGIS Engine 中的相交分析的实现代码

时间:2011-04-09 20:33来源:知行网www.zhixing123.cn 编辑:麦田守望者

在ArcGIS Engine中实现点和面进行相交分析,应该是用IBasicGeoprocessor.Intersect方法,不知道对不对啊?
用点和面进行相交分析,主要目的是为了确定点在哪个区域内!比如可以用一个井的点图层和一个行政区划的面图层进行相交分析,得到的是一个井的点图层,而此图层的属性包含了两个图层的属性,从而通过对属性表的查询,来确定在某个区域内井的个数等等信息。
以下代码编译通过,但是在运行时,就报错,说是参数错误,各位帮忙看看,谢谢!!
1 private void M_OverLayer_Click(object sender, System.EventArgs e)
2 {
3 try
4 {
5 //分析层
6 ILayer pLayer=this.axMapControl1.get_Layer(0);
7 IFeatureLayer pInputFeatLayer=pLayer as IFeatureLayer;
8 ITable pInputTable=pLayer as ITable;
9 IFeatureClass pInputFeatClass=pInputFeatLayer.FeatureClass;
10
11 //叠加表
12 pLayer=this.axMapControl1.get_Layer(1);
13 ITable pOverlayTable=pLayer as ITable;
14
15 //叠加分析表
16 IFeatureClassName pFeatClassName=new FeatureClassNameClass();
17 pFeatClassName.FeatureType=esriFeatureType.esriFTSimple;
18 pFeatClassName.ShapeFieldName="shape";
19 pFeatClassName.ShapeType=pInputFeatClass.ShapeType;
20
21 //工作空间名称
22 IWorkspaceName pNewWSName=new WorkspaceNameClass();
23 pNewWSName.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory";
24 pNewWSName.PathName = @"C:\temp";
25
26 //数据集名称
27 IDatasetName pDatasetName=pFeatClassName as IDatasetName;
28 pDatasetName.Name="ss";
29 pDatasetName.WorkspaceName=pNewWSName;
30
31 //几何处理
32 IBasicGeoprocessor pBGP=new BasicGeoprocessorClass();
33 IFeatureClass pOutputFeatClass=pBGP.Intersect(pInputTable,false,pOverlayTable,false,0.01,pFeatClassName);
34
35 //输出要素层设置
36 IFeatureLayer pOutputFeatLayer=new FeatureLayerClass();
37 pOutputFeatLayer.FeatureClass=pOutputFeatClass;
38 pOutputFeatLayer.Name=pOutputFeatClass.AliasName;
39
40 this.axMapControl1.AddLayer((ILayer)pOutputFeatClass,0);
41 axMapControl1.Update();
42 }
43 catch(Exception ex)
44 {
45 MessageBox.Show(ex.Message);
46 }
47 }
 

------分隔线----------------------------
标签(Tag):Arcgis Arcgis开发 Arcgis开发教程 Arcgis程序代码
------分隔线----------------------------
推荐内容
猜你感兴趣
博聚网