ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • 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 类概述

更改类的值或属性

  • 要更改类对象的值,只能重新创建该类。
    neighborhood = NbrCircle(5, "MAP")
    
    # The neighborhood object can be changed from a circle to a rectangle
    neighborhood = NbrRectangle(3, 3, "MAP")
    
  • 可通过访问用于将参数存储在对象内的属性来直接更改单个参数。
    >>> neighborhood = NbrCircle(5, "MAP")
    >>> # The following statements change the radius to 7 and the units to CELL
    >>> neighborhood.radius = 7 
    >>> neighborhood.units = "CELL"
    
    >>> print(neighborhood)
    CIRCLE 7 CELL
    
  • 可用代数方法来更改以属性形式存储在对象内的数值参数。
    circle = NbrCircle(5, "CELL")
    
    # The following statement changes the radius to 5.5
    circle.radius = circle.radius * 1.1
    

    也可以使用赋值运算符来更改值。

    # The following statement changes the radius to 5.5
    circle.radius *= 1.1
    

更改使用 Python 列表创建的类

  • 可以为基于列表创建的类将元素添加至 inFeatures 列表。
    >>> arguments = TopoStream(["features1", "features2"]) 
    
    >>> arguments.inFeatures.append("features3")
    >>> arguments.inFeatures += ["features4", "features5"]
    
    >>> print(arguments.inFeatures)
    ['features1', 'features2', 'features3', 'features4', 'features5']
    
  • 也可以从输入列表中删除元素。
    >>> arguments = TopoStream(["features1", "features2", "features3", "features4", "features5"])
    >>> del arguments.inFeatures[2]
    
    >>> print(arguments.inFeatures)
    ['features1', 'features2', 'features4', 'features5']
    
  • 可以更改列表中的特定条目。
    >>> arguments = TopoStream(["features1", "features2"]) 
    >>> arguments.inFeatures[1] = "lake2"
    
    >>> print(arguments.inFeatures)
    ['features1', 'lake2']
    

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

  • 可以为基于列表中的列表创建的类更改重映射表中的条目(更改内部列表中的条目)。
    >>> remap = RemapValue([[1, 11], [2, 12], [3, 13]])
    
    >>> # Change the newValue 12 in the second reclassification to a 10
    >>> remap.remapTable[1][1] = 10
    
    >>> print(remap.remapTable)
    [[1, 11], [2, 10], [3, 13]]
    
  • 重映射表中的单个条目可以用代数方法进行更改。
    remap = RemapRange([[1, 10, 5], [10, 20, 8], [20, 30, 10]])
    
    # The following statement increases the endValue 20 by 5 percent
    remap.remapTable[1][1] *= 1.05 
    
    # Another implementation of increasing an entry by 5 percent
    remap.remapTable[1][1] = remapTable.table[1][1] * 1.05
    
  • 以下示例显示了如何更改重映射表中的各个行(更改整个内部列表)。
    >>> remap = RemapValue([[1, 11], [2, 12], [4, 13]])
    
    >>> # Change the second reclassification [2, 12] to [3,10]
    >>> remap.table[1] = [3, 10]
      
    >>> print(remap.remapTable)
    [[1, 11], [3, 10], [4, 13]]
    
  • 以下示例显示了如何将条目添加到重映射表(添加内部列表)。
    >>> remap = RemapValue([[1, 11], [2, 12], [3, 13]])
    
    >>> # Add a forth reclassification, [4, 14] to the end
    >>> remap.remapTable.append([4, 14]) 
    
    >>> # Another approach for adding a row
    >>> remap.remapTable += [[5, 15]] 
    
    >>> print(remap.remapTable)
    [[1, 11], [2, 12], [3, 13], [4, 14], [5, 15]]
    
  • 以下示例显示了如何将条目从重映射表中删除(删除内部列表)。
    >>> remap = RemapValue([[1, 11], [2, 12], [3, 13], [4, 14], [5, 15]])
    
    >>> # Delete the entire second reclassification
    >>> del remap.remapTable[1]
    
    >>> print(remap.remapTable)
    [[1, 11], [3, 13], [4, 14], [5, 15]]
    

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

  • 可以更改基于列表中一系列类创建的类的列表中的特定点。
    >>> points = [Point(0, 5), Point(15, 175)]
    
    >>> # Change the X value of the second input to 25
    >>> points[1].X = 25 
    
    >>> print(points)
    [<Point (0.0, 5.0, #, #)>, <Point (25.0, 175.0, #, #)>]
    

相关主题

  • 使用 Spatial Analyst 类的概述
  • 创建类
  • 查询类

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

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

关于 Esri

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