在arcmap+vba中使用arcgis中的toolbox中的工具

在VBA中或者VB中用IGeoProcessor接口中的Execute方法可以调用arcgis中所有Toolbox工具。
GP.Execute的命令名称格式如下:“工具名称(toolbox中的名称)”+下划线+所在工具集的假名。如“MosaicToNewRaster_management”
下面例子中调用了MosaicToNewRaster工具--镶嵌栅格数据
Set GP = New GeoProcessor
        Set VA = New VarArray
        GP.OverwriteOutput = True
            outputPath = Left(ListBox.List(i), Len(ListBox.List(i)) - 1)
            tmpNum = InStrRev(outputPath, "\", -1, vbTextCompare)
            mytmpname = Right(outputPath, Len(ListBox.List(i)) - tmpNum - 1)

        VA.Add inputPath
        VA.Add outputPath
        VA.Add tifName
        VA.Add "#"
        VA.Add "8_BIT_UNSIGNED"
        VA.Add "#"
        VA.Add "3"
        VA.Add "LAST"
        VA.Add "FIRST"
       
        GP.Execute "MosaicToNewRaster_management", VA, Nothing

'===初始化GeoProcessor

Dim GP As IGeoProcessor
Set GP = New GeoProcessor

'===输出时覆盖同名文件
GP.OverwriteOutput = True

'//Declare 3 variables for input and output parameters
Dim inputPath As String
Dim outputPath As String
Dim tifName As String

'//定义参数
inputPath = "D:\TEST\Input1.TIF;D:\TEST\Input2.TIF"
outputPath = "D:\TEST"
tifName = "MOS.tif"

'//设置变量数组
Dim VA As IVariantArray

Set VA = New VarArray
    VA.Add inputPath ’==输入的栅格文件
    VA.Add outputPath ’==镶嵌后输出的栅格文件路径
    VA.Add tifName ’==镶嵌后的文件名
    VA.Add "#" ’==定义坐标系统
    VA.Add "8_BIT_UNSIGNED" ’==输出的位数
    VA.Add "#" ’==单元格大小
    VA.Add "3"’===波段
    VA.Add "LAST"   ’ ===重叠区域处理方法
    VA.Add "FIRST" ’ ===色带处理方法

'=====执行工具

 GP.Execute "MosaicToNewRaster_management", VA, Nothing


下面是常用的工具名称及假名

1. Analysis Tools— analysis
2. Conversion Tools— conversion
3. Data Management Tools— management
4. 3D Analyst Tools— 3d
5. Cartography Tools— cartography
6. Geocoding Tools— geocoding
7. Geostatistical Analyst Tools— ga
8. Linear Referencing Tools— lr
9. Multidimension Tools— md
10. Network Analyst Tools— na
11. Samples— samples
12. Spatial Analyst Tools— sa
13. Spatial Statistics Tools— stats
 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值