使用C#开发ArcGIS时,出现错误“System.Runtime.InteropServices.COMException”类型的错误。
调用ArcGIS中的工具箱里面的克里金插值工具时出现的错误。License应该配置没问题,该加的都加了。求大神解决问题。。。...
调用ArcGIS中的工具箱里面的克里金插值工具时出现的错误。License应该配置没问题,该加的都加了。求大神解决问题。。。
展开
展开全部
克里金插值一般不用gp写
给你一段代码
/// <summary>
/// 克里金插值
/// </summary>
/// <param name="pFeatureLayer">输入参数要素图层</param>
/// <param name="strHeightField">插值字段</param>
/// <param name="pCellSize">像元大小</param>
/// <param name="pStyle">插值模型</param>
/// <param name="pRadius">搜索半径</param>
/// <returns></returns>
private IRaster KrigeCreateRaster(IFeatureLayer pFeatureLayer, string strHeightField, double pCellSize, esriGeoAnalysisSemiVariogramEnum pStyle, int pRadius)
{
IRaster pRaster;
IInterpolationOp2 pInterpolation = new RasterInterpolationOpClass();
//设置搜索半径
IRasterRadius pRasterRadius = new RasterRadiusClass();
object oRadius = Type.Missing;
pRasterRadius.SetVariable(pRadius, ref oRadius);
//设置插值字段
IFeatureClassDescriptor pFeatureClassDescriptor = new FeatureClassDescriptorClass() as IFeatureClassDescriptor;
pFeatureClassDescriptor.Create(pFeatureLayer.FeatureClass, null, strHeightField);
//设置像元大小
object oCellSize = pCellSize;
IRasterAnalysisEnvironment pRasterAnalysisEnvironment = pInterpolation as IRasterAnalysisEnvironment;
pRasterAnalysisEnvironment.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref oCellSize);
//克里金插值
object obarrier = Type.Missing;//
pRaster = pInterpolation.Krige(pFeatureClassDescriptor as IGeoDataset, pStyle, pRasterRadius, false, ref obarrier) as IRaster;
return pRaster;
}
给你一段代码
/// <summary>
/// 克里金插值
/// </summary>
/// <param name="pFeatureLayer">输入参数要素图层</param>
/// <param name="strHeightField">插值字段</param>
/// <param name="pCellSize">像元大小</param>
/// <param name="pStyle">插值模型</param>
/// <param name="pRadius">搜索半径</param>
/// <returns></returns>
private IRaster KrigeCreateRaster(IFeatureLayer pFeatureLayer, string strHeightField, double pCellSize, esriGeoAnalysisSemiVariogramEnum pStyle, int pRadius)
{
IRaster pRaster;
IInterpolationOp2 pInterpolation = new RasterInterpolationOpClass();
//设置搜索半径
IRasterRadius pRasterRadius = new RasterRadiusClass();
object oRadius = Type.Missing;
pRasterRadius.SetVariable(pRadius, ref oRadius);
//设置插值字段
IFeatureClassDescriptor pFeatureClassDescriptor = new FeatureClassDescriptorClass() as IFeatureClassDescriptor;
pFeatureClassDescriptor.Create(pFeatureLayer.FeatureClass, null, strHeightField);
//设置像元大小
object oCellSize = pCellSize;
IRasterAnalysisEnvironment pRasterAnalysisEnvironment = pInterpolation as IRasterAnalysisEnvironment;
pRasterAnalysisEnvironment.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref oCellSize);
//克里金插值
object obarrier = Type.Missing;//
pRaster = pInterpolation.Krige(pFeatureClassDescriptor as IGeoDataset, pStyle, pRasterRadius, false, ref obarrier) as IRaster;
return pRaster;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询