ArcGIS Engine中调用GP的两种方法
来源:互联网 发布:叙利亚 知乎 编辑:程序博客网 时间:2024/06/13 12:49
第一种,分别设置参数:
//添加命名空间 using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.Geoprocessor; //实现button click方法 private void button1_Click(object sender, EventArgs e) { //构造Geoprocessor Geoprocessor gp = new Geoprocessor(); //设置参数 ESRI.ArcGIS.AnalysisTools.Intersect intersect = new ESRI.ArcGIS.AnalysisTools.Intersect(); intersect.in_features = @"F:\foshan\Data\wuqutu_b.shp;F:\foshan\Data\world30.shp"; intersect.out_feature_class = @"E:\intersect.shp"; intersect.join_attributes = "ONLY_FID"; //执行Intersect工具 RunTool(gp, intersect, null); } private void RunTool(Geoprocessor geoprocessor, IGPProcess process, ITrackCancel TC) { // Set the overwrite output option to true geoprocessor.OverwriteOutput = true; try { geoprocessor.Execute(process, null); ReturnMessages(geoprocessor); } catch (Exception err) { Console.WriteLine(err.Message); ReturnMessages(geoprocessor); } } // Function for returning the tool messages. private void ReturnMessages(Geoprocessor gp) { string ms = ""; if (gp.MessageCount > 0) { for (int Count = 0; Count <= gp.MessageCount - 1; Count++) { ms += gp.GetMessage(Count); } }另一种添加参数:
//1-定义GeoProcessor对象 Geoprocessor gp = new Geoprocessor(); object sev = null; //2-设置参数 gp.OverwriteOutput = true; //3-设置工具箱所在的路径 gp.AddToolbox(@"F:\lib_test\AirportsAndGolf.tbx"); //4-设置输入参数 IVariantArray parameters = new VarArrayClass(); parameters.Add(@"F:\lib_test\地下水重金属数据.xls\Sheet1$"); parameters.Add("`YEAR` = 2009"); parameters.Add("W20111"); parameters.Add(@"F:\lib_test\temp.gdb\tempwww"); //5-执行工具 gp.Execute("ModelAnalysis", parameters, null);
ESRI官方帮助示例:
1.
using ESRI.ArcGIS.Geoprocessor;using ESRI.ArcGIS.AnalysisTools;public void SampleBufferTool(){ // Initialize the geoprocessor. Geoprocessor GP = new Geoprocessor(); ESRI.ArcGIS.AnalysisTools.Buffer bufferTool = new ESRI.ArcGIS.AnalysisTools.Buffer(); bufferTool.in_features = @"D:\St_Johns\data.mdb\roads_Buffer"; bufferTool.out_feature_class = @"D:\St_Johns\data.mdb\roads"; bufferTool.buffer_distance_or_field = "distance"; GP.Execute(bufferTool, null);}2.
using ESRI.ArcGIS.Geoprocessor;using ESRI.ArcGIS.esriSystem;public void SampleCalculateBestPathTool(){ // Initialize the geoprocessor. Geoprocessor GP = new Geoprocessor(); // Add the BestPath toolbox. GP.AddToolbox(@"C:\SanDiego\BestPath.tbx"); // Generate the array of parameters. IVariantArray parameters = new VarArrayClass(); parameters.Add(@"C:\SanDiego\source.shp"); parameters.Add(@"C:\SanDiego\destination.shp"); parameters.Add(@"C:\SanDiego\bestpath.shp"); // Execute the model tool by name. GP.Execute("CalculateBestPath", parameters, null);
0 0
- ArcGIS Engine中调用GP的两种方法
- ArcGIS Engine中调用GP的两种方法
- ArcGIS Engine调用GP服务
- ArcGIS Engine中如何调用GP工具(一)
- ArcGIS Engine中如何调用GP工具(二)
- ArcGIS engine调用GP服务说明
- ArcGIS Engine调用自定义GP服务(一)
- ArcGIS Engine调用自定义GP服务(二)
- ArcGIS Engine调用自定义GP服务(一)
- 使用 VC++ 调用arcgis engine中的gp工具
- 学习笔记之ArcGIS Engine调用自定义GP服务(二)
- ArcGIS Engine中删除要素的几种方法总结
- ArcGIS Engine开发中利用GP工具时常出现的错误
- delphi 调用arcgis的 gp工具
- 最近在ArcGIS Engine开发中关于调用gp工具过程出现COM 组件的调用返回了错误 HRESULT E_FAIL 错误的解决方法 和 学习oracle中遇到的一些问题总结
- (转载)ArcGIS Engine中各种点的创建方法
- 学习笔记之ArcGIS Engine调用自定义GP服务(亲测!!!)(一)
- 学习笔记之ArcGIS Engine调用自定义GP服务(亲测!!!)(二)
- linux 下的 wchar_t
- 数数(南阳oj198)
- Dynamic pull and push in 0.9.19
- 第十五周 OJ平台-指针的基本操作(2)
- 第十五周项目3在OJ上玩指针
- ArcGIS Engine中调用GP的两种方法
- Java并发编程之ConcurrentHashMap
- Navicat for Mysql 模拟实现oracle sequence
- 第十五周项目三——在OJ上玩指针(1)
- 第十五周项目一 打入内部寻内幕
- 0094 ThreadGroup和ExecutorService比较【进阶】
- IOS note (三)NSFileHandle用法
- 十一月学习总结
- linux timer应用