当前位置:网站首页>使用Geoprocessor 工具
使用Geoprocessor 工具
2022-07-26 10:34:00 【WindOfMayGIS】
使用Geoprocessor 工具
GP可以理解成是跑ToolBox中工具的代理,实现的过程是先将工具参数设置好,之后将GP参数设置好,就可以执行了。
每个GP工具都有一组固定的参数(a fixed set of parameters)。
- Name—Each tool parameter has a unique name.
- Type—The type of data expected, such as feature class, integer, string, and raster.
- Required—Either a value must be provided for a parameter or it is optional.
GP除了可以跑Esri定义的Tools,还可以跑用户自定义的模块或脚本工具。以下分两种方式来操作,一是跑ESRI的工具,另一是跑用户自定义的模块或脚本工具。
一:ESRI的工具
ESRI提供的工具有:
Toolbox names | Namespaces |
3D Analyst tools | ESRI.ArcGIS.Analyst3DTools |
Analysis tools | ESRI.ArcGIS.AnalysisTools |
Conversion tools | ESRI.ArcGIS.ConversionTools |
Data Management tools | ESRI.ArcGIS.DataManagementTools |
Cartography tools | ESRI.ArcGIS.CartographyTools |
Coverage tools | ESRI.ArcGIS.CoverageTools |
Geocoding tools | ESRI.ArcGIS.GeocodingTools |
Geostatistical Analyst tools | ESRI.ArcGIS.GeostatisticalAnalystTools |
Linear Referencing tools | ESRI.ArcGIS.LinearReferencingAnalystTools |
Multidimension tools | ESRI.ArcGIS.MultidimensionTools |
Network Analyst tools | ESRI.ArcGIS.NetworkAnalystTools |
Samples | ESRI.ArcGIS.SamplesTools |
Spatial Analyst tools | ESRI.ArcGIS.SpatialAnalystTools |
Spatial Statistics tools | ESRI.ArcGIS.SpatialStatisticsTools |
实现对FeatureLayer生成缓冲区,并保存的功能
//第一步设置Buffer参数
IFeatureLayerpINFeaLyr = GetFeaLyr(pMap, "QSJZD_H_320482"); //获取要生成缓冲区的FeatureLayer
ESRI.ArcGIS.AnalysisTools.Bufferbuffer = new ESRI.ArcGIS.AnalysisTools.Buffer();
buffer.in_features= pINFeaLyr;//可以是指定的图层,也可以是指定的路径,如果是路径,一定是FullName
buffer.out_feature_class= @"E:\研究生工作\注记压盖与定位\04Data\temp\buffer.shp";//输出路径,切记文件目录要实际存在,但Buffer.shp是导出的文件名
buffer.buffer_distance_or_field= "10 METERS";//属性字段名或制定距离,制定距离时一定注意,数字和单位之间必须有空格
buffer.dissolve_option= "ALL";//ALL表明缓冲区重叠时,融合
//第二步设置GP参数
Geoprocessorgp = new Geoprocessor();
gp.OverwriteOutput= true; //覆盖原有文件并重写
//第三步执行GP
gp.Execute(buffer, null);
二:运行自定义的工具(该代码来源AEHelper)
publicvoid SampleCalculateBestPathTool()
{
// Initialize the geoprocessor.
Geoprocessor GP = new Geoprocessor();
// Add the BestPath toolbox.
GP.AddToolbox(@"C:\SanDiego\BestPath.tbx");
// Generate the array of parameters.
IVariantArrayparameters = 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);
}
边栏推荐
- What is wrong about the description of function templates (how to solve link format errors)
- C语言回调函数
- MD5加密
- json-c库的简单使用——将json文件转换为struct.
- Navicat15 MySQL (centos7) connected to local virtual machine
- 事务的传播性propagation
- Navicat15连接本地虚拟机的Mysql(Centos7)
- 我们的Web3创业项目,黄了
- 【dectectron2】跟着官方demo一起做
- Uninstall Meizu app store
猜你喜欢
随机推荐
2022/07/25 ------ arrangement of strings
[Halcon vision] polar coordinate transformation
[C language] named type and anonymous type
What if MySQL can't get in
软件打不开了
11 在 operator= 中处理“自我赋值”
数据分析入门 | kaggle泰坦尼克任务(一)—>数据加载和初步观察
[Halcon vision] image gray change
少了个分号
[Halcon vision] Fourier transform of image
Redis Docker实例与数据结构
粽子大战 —— 猜猜谁能赢
Google与Pixar开发Draco支持USD格式 加速3D对象传输<转发>
Interview questions and answers for the second company (2)
Introduction to data analysis | kaggle Titanic mission
同步方法中不使用asyncTask<T> 修饰和await获取异步返回值(同步方法中调用异步方法)
datav漂亮数据屏制作体验
Redis docker instance and data structure
Inheritance method of simplified constructor (I) - combined inheritance
Database functions