重新选择样本 (Data Reviewer)

需要 Data Reviewer 许可。

摘要

从要素图层或表视图中重新选择先前生成的随机选择。 此工具使用基于 .json 文件(由选择随机样本工具生成)中的 SQL 查询的输入数据应用选择。

使用情况

  • 输入 JSON 文件参数值存储以下信息:

    • 工具的运行日期和时间
    • 输入源于的工作空间
    • 输入要素图层或表的名称
    • 选定记录总数
    • 选定记录的 OID
    • 用于选择的 SQL 表达式
  • 选择随机样本工具的输出 .json 文件存储将应用于输入要素图层或表视图的 SQL 查询。

  • 将在数据上创建一个新的选择。 运行此工具之前所做的任何选择都将被清除或忽略。 使用所选记录切换按钮状态不会影响重新选择,因为此工具将在输入行参数中指定的要素图层或表中的所有行上运行。

  • 在运行工具前,要素图层或表必须具有 ObjectID 字段。

  • 如果关闭使用选定记录切换按钮,则输出文件参数值将记录基于整个数据集的随机要素选择。 但是,如果应用定义查询,则仅地图框中与查询相匹配的要素或行处于选中状态。

参数

标注说明数据类型
输入行

将应用选择的要素图层或表视图。

Feature Layer; Table View
输入 JSON 文件

将用于从输入要素图层或表视图中重新选择记录的 .json 文件。 此文件使用选择随机样本工具生成。

File

派生输出

标注说明数据类型
已更新行

已应用选择的已更新输入。

Feature Layer; Table View

arcpy.Reviewer.ReselectSample(in_layer_or_view, in_file)
名称说明数据类型
in_layer_or_view

将应用选择的要素图层或表视图。

Feature Layer; Table View
in_file

将用于从输入要素图层或表视图中重新选择记录的 .json 文件。 此文件使用选择随机样本工具生成。

File

派生输出

名称说明数据类型
out_layer_or_view

已应用选择的已更新输入。

Feature Layer; Table View

代码示例

ReselectSample 示例 1 (Python)

以下 Python 窗口脚本演示了如何使用 ReselectSample 函数。

import arcpy
arcpy.env.workspace = r"C:\USAData\Data.gdb"
arcpy.ReselectSample_Reviewer("Cities", in_file = "C:\\USAData\\Cities_Sample.json")
ReselectSample 示例 2(独立脚本)

在 Cities 要素图层中重新选择随机要素。

# Name: ReselectSample_Example.py
# Description: Use the ReselectSample tool in ArcGIS Pro to reselect a random sample of features from a feature class.

# Import system modules
import arcpy

# Set environment workspace
arcpy.env.workspace = r"C:\USAData\Data.gdb"

# Set local variables
in_layer_or_view = "Cities"
in_file = r"C:\USAData\Cities_Sample.json"

# Reselect a random sample of features
arcpy.ReselectSample_Reviewer(in_layer_or_view, in_file)

许可信息

  • Basic: 需要 Data Reviewer
  • Standard: 需要 Data Reviewer
  • Advanced: 需要 Data Reviewer

相关主题