使用C#开发ArcGIS时,出现错误“System.Runtime.InteropServices.COMException”类型的错误。
调用ArcGIS中的工具箱里面的克里金插值工具时出现的错误。License应该配置没问题,该加的都加了。求大神解决问题。。。...
调用ArcGIS中的工具箱里面的克里金插值工具时出现的错误。License应该配置没问题,该加的都加了。求大神解决问题。。。
展开
1个回答
展开全部
克里金插值一般不用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;
}
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询