阅读:3538回复:11
用什么方法可以得到图层间的相交、包含阿等的结果
<P>现在 知道两个选定的层,怎么得到它们相交(intersect)的结果?</P>
<P>用什么方法?</P> <img src="images/post/smile/dvbbs/em08.gif" /> |
|
1楼#
发布于:2005-06-06 21:46
<P>谁用过这个方法,帮我看看我的代码错在哪好吗?</P>
<P>//如果用户点击确定按钮<br> if(md.DialogResult == DialogResult.OK )</P> <P> //选择"selece from the" 用户操作<br> if (md.selectedOperateIndex == 0)<br> <br> //选择的层的操作为intersect<br> if (md.layerOperateMethodIndex == 0)</P> <P> <br> <br> <br> if (md.checkedListBox1.SelectedIndices.Count> 0 )<br> for (int i = 0;i < md.checkedListBox1.SelectedIndices.Count;i++)<br> {<br> inputfeaturelayer =(FeatureLayer)this.axMapControl1.get_Layer(md.checkedListBox1.SelectedIndices);<br> MessageBox.Show(inputfeaturelayer.Name.ToString());<br> //确定输入table <br> ITable inputTable = (ITable)inputfeaturelayer;</P> <P> //定义输入featureclass(备用)<br> IFeatureClass inputfeatureclass = inputfeaturelayer.FeatureClass;</P> <P> //确定用户选择的单层(overlayfeaturelayer)<br> overlayfeatureLayer = (FeatureLayer)this.axMapControl1.get_Layer(md.selectedlayerIndex);<br> MessageBox.Show(overlayfeatureLayer.Name.ToString());<br> //确定OverlayTable<br> ITable OverlayTable = (ITable)overlayfeatureLayer;</P> <P> //Table错误检查<br> if (inputTable == null)<br> MessageBox.Show("Table QI failed");<br> if (OverlayTable == null)<br> MessageBox.Show("Table QI failed");</P> <P> MessageBox.Show("Table QI failed");</P> <P> //定义输出featureclass name和shape type(由输入feature class决定)<br> IFeatureClassName featureclassName = new FeatureClassNameClass();<br> featureclassName.FeatureType = esriFeatureType.esriFTSimple;<br> featureclassName.ShapeType = inputfeatureclass.ShapeType;<br> featureclassName.ShapeFieldName = "shape";</P> <P> //设置输出路径和featureclass名称<br> IWorkspaceName wsName = new WorkspaceNameClass();<br> wsName.WorkspaceFactoryProgID = "esriCore.ShapeFileWorkspaceFactory.1";<br> wsName.PathName = "C:\temp";<br> IDatasetName datasetName = (IDatasetName)featureclassName;<br> datasetName.Name = "Intersect_result";<br> datasetName.WorkspaceName = wsName;<br> <br> //设置tolerance<br> double tol = 0.0;</P> <P> IBasicGeoprocessor BSGeop = new BasicGeoprocessorClass();<br> MessageBox.Show("error?");<br> //IFeatureClass outputfeatureclass = new FeatureClassClass();<br> IFeatureClass outputfeatureclass = BSGeop.Intersect(inputTable, false, OverlayTable, false, tol,featureclassName);<br> <br> //加载输出层到当前地图<br> IFeatureLayer outputfeaturelayer = new FeatureLayerClass();<br> outputfeaturelayer.FeatureClass = outputfeatureclass;<br> outputfeaturelayer.Name = outputfeatureclass.AliasName;<br> this.axMapControl1.AddLayer(outputfeaturelayer,this.axMapControl1.LayerCount);</P> <P><STRONG><FONT face=Verdana color=#61b713>调试最后停在这一行代码上:IFeatureClass outputfeatureclass = BSGeop.Intersect(inputTable, false, OverlayTable, false, tol,featureclassName);</FONT></STRONG></P> <P><FONT face=Verdana color=#61b713><STRONG>提示错误为:未处理的“System.Runtime.InteropServices.COMException”类型的异常出现在 control.exe 中。</STRONG></FONT></P> <P><STRONG><FONT face=Verdana color=#61b713>其他信息: 未指定的错误</FONT></STRONG></P> <P><br> </P><img src="images/post/smile/dvbbs/em08.gif" /> [此贴子已经被作者于2005-6-6 21:53:31编辑过]
|
|
2楼#
发布于:2005-06-05 19:58
<P>可以把你用这个接口的代码发给我参考一下吗?</P><img src="images/post/smile/dvbbs/em08.gif" />
|
|
3楼#
发布于:2005-06-04 18:25
<P>接口我用过,不然也不可能让你用。不过我不用C#,所以不大清楚你的情况。</P>
|
|
4楼#
发布于:2005-06-04 12:27
<P>请教<STRONG><FONT face=Verdana color=#61b713>wolfmanchen,你用过IBasicGeoProcessor接口的吧,</FONT></STRONG></P>
<P><STRONG><FONT face=Verdana color=#61b713>我昨天试过了,但调试有错误,调试最后停在这一行代码上:IFeatureClass outputfeatureclass = BSGeop.Intersect(inputTable, false, OverlayTable, false, tol,featureclassName);</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>提示错误为:未处理的“System.Runtime.InteropServices.COMException”类型的异常出现在 control.exe 中。</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>其他信息: 未指定的错误</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>上面一行代码的几个参数我基本上都用MessageBox.Show检查都能正确输出我所选择的层,但为什么还有上面的错误呢?不知道怎么导致的,也不知道该怎么改了,</FONT></STRONG></P> <P><STRONG><FONT face=Verdana color=#61b713>对了我用的是C#<BR></P></FONT></STRONG> |
|
5楼#
发布于:2005-06-03 09:39
<P>还有FeatureClass_2也没有</P>
<P>怎么回事呢?</P> |
|
6楼#
发布于:2005-06-03 09:36
<P>再问大家,为什么我的ARCGIS9的开发帮助文档里差很多例子和类、接口的帮助内容呢?大家有遇到吗?怎么解决的?</P>
<P>上面的说得IBasicGeoProcessing接口的例子就打不开,你们的能打开吗?</P><img src="images/post/smile/dvbbs/em08.gif" /> |
|
7楼#
发布于:2005-06-03 09:01
<P>谢谢各位,回去学习了再来请教!</P><img src="images/post/smile/dvbbs/em08.gif" />
|
|
8楼#
发布于:2005-06-02 14:28
看IBasicGeoprocessor 接口!
|
|
9楼#
发布于:2005-05-31 19:20
<H1><FONT size=1>ISpatialFilter Interface?</FONT></H1>
|
|
上一页
下一页