来自:http://zhihu.esrichina.com.cn/?/question/12087
Engine中执行gp工具返回的【解决办法】:
需要用gpUtils.DecodeFeatureLayer方法将gp工具生成的图层先读取出来,如:
// Intialize the geoprocessor. Geoprocessor GP = new Geoprocessor(); // Intialize the MakeFeatureLayer tool. MakeFeatureLayer makefeaturelayer = new MakeFeatureLayer(); // Set up the GP tool parameters and run the tool. makefeaturelayer.in_features = @C:gp fld.gdbwells; makefeaturelayer.out_layer = Wells_Lyr; makefeaturelayer.where_clause = WELL_YIELD > 150; IGeoProcessorResult result = (IGeoProcessorResult)GP.Execute(makefeaturelayer, null); IFeatureClass fc; IQueryFilter qf; IGPUtilities gpUtils = new GPUtilitiesClass(); gpUtils.DecodeFeatureLayer(result.GetOutput(0), out fc, out qf); IFeatureCursor cursor = fc.Insert(true);
要素图层如何获取?比如make query layer工具