问题描述
- C#调用ArcEngine的Geoprocessor工具消除图斑
-
ArcEngine调用Geoprocessor工具SelectLayerByAttribute选择面积小于500的图斑,可以正常运行Geoprocessor GP = new Geoprocessor(); g.OverwriteOutput = true; SelectLayerByAttribute SelectByAttribute = new SelectLayerByAttribute(); ILayer featureLayer = axMapControl1.get_Layer(0); SelectByAttribute.in_layer_or_view = featureLayer; SelectByAttribute.selection_type = "NEW_SELECTION"; SelectByAttribute.where_clause = "AREA <500"; g.Execute(SelectByAttribute,null);
选择图斑之后,调用Eliminate消除图斑
String output = @"C:UserszcDocumentsArcGISDefault.gdbsoils_Eliminate4"; Eliminate eliminate = new Eliminate(); eliminate.in_features = featureLayer; eliminate.out_feature_class = output; g.Execute(eliminate, null);
出现错误,错误提示
Message "对 COM 组件的调用返回了错误 HRESULT E_FAIL。"StackTrace " 在 ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel)
在 ESRI.ArcGIS.Geoprocessor.Geoprocessor.ExecuteInner(IGPProcess process, ITrackCancel trackCancel, IGeoProcessor igp, IVariantArray iva)
在 ESRI.ArcGIS.Geoprocessor.Geoprocessor.Execute(IGPProcess process, ITrackCancel trackCancel)
在 stretch.Form1.button2_Click(Object sender, EventArgs e) 位置 D:stretchstretchForm1.cs:行号 94"
网上关于这方面的资料很少,应该是eliminate的参数有错误,arcengine帮助文档给的参数类型是“object”,不清楚到底是什么类型的参数,有做过这方面的前辈指点一下吗?
解决方案
大神 这个问题解决了吗 我调用平滑面的GP工具报 "对 COM 组件的调用返回了错误 HRESULT E_FAIL 这个错误,调用裁切GP工具都没有问题,调用方法是一样的,这是为什么呢
时间: 2024-12-28 21:10:06