public static Boolean Merge(String[] inputs,String output) { Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true; int strSize = inputs.Count(); String tempStr = "\""+inputs[0]+""; for (int i = 1; i < strSize-1; i++) { tempStr += ";" + inputs[i]+""; } tempStr += ";" + inputs[strSize - 1] + "\""; MessageBox.Show("input: "+ tempStr); ESRI.ArcGIS.DataManagementTools.Merge merge = new ESRI.ArcGIS.DataManagementTools.Merge(); merge.inputs = tempStr; merge.output = output; try { gp.Execute(merge, null); } catch (COMException e) { string str = ""; for (int i = 0; i < gp.MessageCount; i++) { str += gp.GetMessage(i); } MessageBox.Show(str); return false; } return true; }
主要需要注意下 input参数的怎么组织问题;跟python脚本里面组织参数的形式有点不一样!