阅读:1314回复:1
叠加分析报错,恳请高手赐教!C#+engine代码如下
<P> private void button5_Click(object sender, EventArgs e)<BR> {<BR> <BR> try<BR> {<BR> //分析层<BR> ILayer pLayer=this.axMapControl1.get_Layer(0);<BR> IFeatureLayer pInputFeatLayer=pLayer as IFeatureLayer; <BR> ITable pInputTable=pLayer as ITable;<BR> IFeatureClass pInputFeatClass=pInputFeatLayer.FeatureClass;</P>
<P> //叠加表<BR> pLayer=this.axMapControl1.get_Layer(1);<BR> ITable pOverlayTable=pLayer as ITable;</P> <P> //叠加分析表<BR> IFeatureClassName pFeatClassName=new FeatureClassNameClass();<BR> pFeatClassName.FeatureType=esriFeatureType.esriFTSimple;<BR> pFeatClassName.ShapeFieldName="shape";<BR> pFeatClassName.ShapeType=pInputFeatClass.ShapeType;</P> <P> //工作空间名称<BR> IWorkspaceName pNewWSName=new WorkspaceNameClass();<BR> pNewWSName.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory";<BR> pNewWSName.PathName = @"C:\temp";</P> <P> //数据集名称<BR> IDatasetName pDatasetName=pFeatClassName as IDatasetName;<BR> pDatasetName.Name="ss";<BR> pDatasetName.WorkspaceName=pNewWSName; </P> <P> //几何处理<BR> IBasicGeoprocessor pBGP=new BasicGeoprocessorClass();<BR> IFeatureClass pOutputFeatClass=pBGP.Intersect(pInputTable,false,pOverlayTable,false,0.01,pFeatClassName); <BR> <BR> //输出要素层设置<BR> IFeatureLayer pOutputFeatLayer=new FeatureLayerClass();<BR> pOutputFeatLayer.FeatureClass=pOutputFeatClass;<BR> pOutputFeatLayer.Name=pOutputFeatClass.AliasName;</P> <P> this.axMapControl1.AddLayer((ILayer)pOutputFeatClass,0);<BR> axMapControl1.Update();<BR> }<BR> catch(Exception ex)<BR> {<BR> MessageBox.Show(ex.Message);<BR> }<BR> }</P> |
|
1楼#
发布于:2007-12-28 18:12
<P>报信息:1。对com组件的调用返回了错误,HRESULT E-FAIL</P>
<P> 2。值不在预期的范围内</P> |
|