xufgis
路人甲
路人甲
  • 注册日期2007-09-21
  • 发帖数2
  • QQ
  • 铜币115枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1065回复:0

求教关于Trend函数的第一个参数IGeoDataSet的问题(AE9.2 C#)

楼主#
更多 发布于:2008-03-17 11:13
<P> Help上面说  IGeoDataSet:</P>
<P>A Featureclass or FeatureclassDescriptor containing point features with z-values to be converted to a raster surface.   </P>
<P>下面的代码能够读出FeatureClass,其参数只有 FID,Object(点),value(double类型),但在使用Trend函数的时候就会报错:<FONT color=#ff3300>Could not get featureclass</FONT>.</P>
<P >请问是什么问题?程序中不能用FeatureClass As IGeoDataset还是数据文件有问题,只能用X,Y,不能用Object?</P>
<P >另外,我参考帮助文件使用IFeatureClassDescriptor也不行,想直接从txt中读取点信息也没有成功,测试过程都在。</P>
<P >谢谢!</P>
<P>代码如下:</P>
<P>        private void TrendTest()<BR>        {<BR>            <BR>            IWorkspaceFactory asd;<BR>            asd = new ShapefileWorkspaceFactoryClass();<BR>            IFeatureWorkspace ifwsp = asd.OpenFromFile(@"E:\Map", 0) as IFeatureWorkspace;<BR>            IFeatureClass ifclass = ifwsp.OpenFeatureClass("194902lit");            </P>
<P>            /*<BR>             * 错误的办法,想直接读取txt到FeatureClass,但OpenFeatureClass函数出错<BR>            IWorkspaceFactory asd;<BR>            asd = new TextFileWorkspaceFactoryClass();<BR>            IFeatureWorkspace ifwsp = asd.OpenFromFile(@"E:\My Document\Map", 0) as IFeatureWorkspace;<BR>            IFeatureClass ifclass = ifwsp.OpenFeatureClass("InputSample.txt");            //OpenFeatureClass("InputSample");  也有问题</P>
<P>            */</P>
<P>            IInterpolationOp pInterpolationOp;<BR>            pInterpolationOp = new RasterInterpolationOpClass();</P>
<P>            /* 另外一种尝试,根据9.0的Sample使用 IFeatureClassDescriptor ,在Trend()时也提示参数不对<BR>            IFeatureClassDescriptor pFCDes= new FeatureClassDescriptorClass();<BR>            pFCDes.Create(ifclass, null, "中心气压");<BR>            pOutputRaster = pInterpolationOp.Trend(pFCDes, esriGeoAnalysisTrendEnum.esriGeoAnalysisLinearTrend, 2);<BR>             */</P>
<P>            IGeoDataset pInputPoints = ifclass as IGeoDataset;</P>
<P>            if (pInputPoints == null)<BR>                return;</P>
<P>            IGeoDataset pOutputRaster;<BR>            pOutputRaster = pInterpolationOp.Trend(pInputPoints, esriGeoAnalysisTrendEnum.esriGeoAnalysisLinearTrend, 2);<BR>            //上句报错</P>
<P>            //添加到mapcontrol中,还不知道能不能用<BR>            IFeatureLayer iflay;<BR>            iflay = new FeatureLayerClass();<BR>            iflay.FeatureClass = pOutputRaster as IFeatureClass;<BR>            iflay.Name = "TestTrend";<BR>            IMap map = axMapControl1.Map;<BR>            map.AddLayer(iflay);<BR>        }</P>
喜欢0 评分0
游客

返回顶部