public static bool Sample(List<string> inRasters, string locationData, string outTable,string resamplingType,string outExcel) { Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true; string istr = inRasters[0]; for (int j = 1; j < inRasters.Count(); j++) { istr += ";" + inRasters[j]; } ESRI.ArcGIS.SpatialAnalystTools.Sample sam = new ESRI.ArcGIS.SpatialAnalystTools.Sample(); sam.in_rasters = istr;//inRasters; sam.in_location_data = locationData; sam.out_table = outTable; sam.resampling_type = resamplingType; try { gp.Execute(sam, null); } catch (COMException e) { string str = ""; for (int i = 0; i < gp.MessageCount; i++) { str += gp.GetMessage(i); } MessageBox.Show(str); return false; } if (!ExcelUtil.CreateExcelByItable(outTable,outExcel)) { MessageBox.Show("生成Excel表格失败!"); return false; } return true; }
时间: 2024-10-10 22:09:26