ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

创建类

需要 Spatial Analyst 许可。

  • 使用固定数量的输入创建的类
  • 使用 Python 列表或列表中的列表创建的类
  • 基于列表中的一系列类创建的类
  • 默认参数

要在地理处理工具的输入参数中使用类,必须首先创建类。对这些类进行实例化之后,便可访问类的属性,并且还可对这些对象进行查询或修改。了解如何创建各种类对象的最简单方法是,查阅使用不同输入类型创建类的示例。

提示:

每个类的文档中都包含一个脚本实例,其介绍了如何在工具参数中定义和使用各个类。

  • Spatial Analyst 类概述

使用固定数量的输入创建的类

  • 下面是基于固定数量的输入创建各种类的示例:
    # Creating a neighborhood class and assigning it to a variable
    neighborhood = NbrRectangle(10, 10, "CELL") 
    
    outFocalStats = FocalStatistics(inRas, neighborhood, "MINORITY")
    
    # Creating the Kriging model to be used
    kModelOrdinary = KrigingModelOrdinary("CIRCULAR", 2000, 2.6, 542, 0)
    
    # Creating a radius class and assigning it to a variable
    kRadius = RadiusFixed(20000, 1) 
    
    outKriging = Kriging(inFeatures, field, kModelOrdinary, cellSize, 
                         kRadius, outVarRaster)
    

使用 Python 列表或列表中的列表创建的类

  • 以下示例介绍了根据列表来创建要在地形转栅格工具中使用的类:
    # Create classes as input for TopoToRaster
    myTopoPtElev = TopoPointElevation([["spots.shp", "spot_meter"], 
                                       ["spots2.shp", "elev"]]) 
    myTopoContour = TopoContour([["contours.shp", "spot_meter"]]) 
    myTopoBoundary = TopoBoundary(["boundary.shp"]) 
    myTopoLake = TopoLake(["lakes.shp"])
    myTopoSink = TopoSink([["sink1.shp", "elevation"], ["sink2.shp", "NONE"]]) 
    myTopoStream = TopoStream(["streams.shp"])
    
    # Applying the tool
    outTopoToRaster = TopoToRaster([myTopoPtElev, myTopoContour, myTopoBoundary, 
                                    myTopoLake, myTopoSink, myTopoStream])
    
  • 以下示例介绍了根据列表来创建要在重分类工具中使用的类:
    # The RemapValue class has a usage of: 
    #   RemapRange(startValue, endValue, newValue)
    RemapTable = RemapValue([[1, 5], [2, 8], [3, 1], [4, 10]])
    
    # Run the tool 
    outReclass = Reclassify("inRas", RemapTable)
    

基于列表中的一系列类创建的类

  • 下面的示例介绍了根据列表中的一系列点类来创建要在栅格像元提取中使用的类:
    # Identify the points to be extracted by creating a list
    #   of Point objects.
    PointsToExtract = [Point(0, 5), Point(15, 175), Point(225, 450)] 
    
    # Run the tool
    Outraster = ExtractByPoints(PointsToExtract)
    

默认参数

  • 某些参数是可选的,在使用时以 {}(大括号)进行定义。例如,楔形邻域类的语法如下:
    NbrWedge({radius}, {startAngle}, {endAngle}, {units})
    
  • 如果未指定可选参数,则使用默认值。
    # The circle neighborhood will default to
    #   a radius of 3 and units of CELL
    circle = NbrCircle()
    
  • 可以通过空引号 "" 或 "#" 来指定可选参数,表示应跳过该值而使用默认值。

相关主题

  • 使用 Spatial Analyst 类的概述
  • 查询类
  • 更改类中的参数

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2018 Esri. | 隐私政策 | 法律声明