Skip to main content

创建聚合查询图层 (数据管理工具)

汇总

创建一个查询图层,该图层根据相关表的时间、范围和属性查询动态地汇总、聚合和过滤 DBMS 表,并将结果连接到要素图层。

了解有关将值聚合到相关要素的详细信息

用法

  • 查询图层仅适用于企业级数据库。 文件地理数据库不是此工具的有效输入工作空间。

  • 聚合结果始终在数据库级别动态计算。

  • 输出图层值将由包含统计运算结果的字段组成。 默认情况下,计数统计数据包括在 ROW_COUNT 字段中。

  • 使用此工具可以执行的统计运算包括计数、总和、平均值、最小值、最大值和标准差。

  • 将使用以下命名约定为每种统计类型创建字段:COUNT_<field>SUM_<field>AVG_<field>MIN_<field>MAX_<field>STDDEV_<field>(其中 &lt;field> 是计算统计数据的输入字段的名称)。

  • 相关连接字段值用于此工具生成的 SQL 语句中的 GROUP BY 子句。 将根据相关连接字段值单独为每个唯一属性值计算统计数据。

  • 该工具创建的图层是临时图层,如果不保存此工程、将图层保存至图层文件或者使用 复制行复制要素 通过创建副本对数据进行持久化,则该图层在会话结束后将不会继续存在。

参数

标注 说明 数据类型

目标要素类

来自企业级地理数据库的要素类或空间表。

Feature Class

目标连接字段

连接所依据的目标要素类中的字段。

Field

相关表

包含用于计算统计数据的字段的输入表。 统计数据连接到输出图层值。

Table; Feature Class

相关连接字段

汇总表中的字段,其中包含连接所依据的值。 还会根据此字段单独为每个唯一属性值计算聚合或汇总统计数据。

Field

输出图层

将要创建的查询图层的输出名称。

Feature Layer

汇总字段

(可选)

指定包含用于计算指定统计数据的属性值的一个或多个数值字段。 可以指定多项统计和字段组合。 空值将被排除在所有统计计算之外。

输出图层将包括一个 ROW_COUNT 字段,显示相关连接字段值的每个唯一值的总数(或频数)。 ROW_COUNT 字段和计数统计类型的区别在于 ROW_COUNT 包括空值,而计数不包括空值。

值表列:

  • Aggregate TypeThe statistic type.

    • CountThe number of values included in the statistical calculations will be found. Each value will be counted except null values.

    • SumThe values for the specified field will be added together.

    • AverageThe average for the specified field will be calculated.

    • MinimumThe smallest value for all records of the specified field will be found.

    • MaximumThe largest value for all records of the specified field will be found.

    • Standard deviationThe standard deviation of values in the specified field will be calculated.

  • Field Name(s)The field containing attribute values used to calculate the specified statistic.

Value Table

参数定义

(可选)

为标准或条件指定一个或多个查询参数,并在计算聚合结果时使用与这些条件相匹配的记录。 查询参数类似于 SQL 语句的变量,进行查询时即会定义该变量的值。 这样,您便可以动态地更改输出图层的查询过滤器。 您可以将参数视为 SQL where 子句中的谓词或条件。 例如,Country_Name = 'Nigeria' 在 SQL where 子句中称为谓词,其中 = 是比较运算符,Country_Name 是左侧的字段名称,'Nigeria' 是右侧的值。 当您定义多个参数时,必须在这些参数之间指定一个逻辑运算符(如 AND、OR 等)。

了解有关在查询图层中定义参数的详细信息

如果未进行指定,则相关表中的所有记录都将用于计算聚合或汇总结果。

两种参数定义类型如下所示:

值表列:

  • Parameter TypeSpecifies the parameter type.

    • RangeRange parameters connect numeric or temporal values dynamically to the range and time sliders.

    • DiscreteDiscrete parameters update a query with literal values when the query is run.

  • NameThe name of the parameter, which is similar to a variable name. A name cannot contain spaces or special characters. Once the output query layer is created and the layer source SQL statement is checked, this name in the SQL statement that defines the output query layer source will be prefixed with either ::r: (for range parameter) or :: (for discrete parameter).

  • AliasThe alias for the parameter name. The alias can include spaces and special characters.

  • Field or ExpressionA field name or a valid SQL expression that will be used in the left side of a predicate or condition in a where clause.

  • Data typeThe data type of the field or expression specified in the Field or Expression column. When using a range parameter type, the data type cannot be string.

    • DateThe data type of the field or expression will be Date (date time).

    • StringThe data type of the field or expression will be String (text).

    • IntegerThe data type of the field or expression will be Integer (whole numbers).

    • DoubleThe data type of the field or expression will be Double (fractional numbers).

  • Start ValueThe default start value for the range parameter type. This is the value that will be used when the time or range slider is not enabled. When the start value and end value column values are omitted and the time or range slider is disabled, all records from the related table will be used to compute aggregated results. This value is ignored when using a discrete parameter type.

  • End ValueThe default end value for the range parameter. This is the value that will be used when the time or range slider is not enabled. When the start value and end value column values are omitted and the time or range slider is disabled, all records from the related table will be used to compute aggregated results. This value is ignored when using a discrete parameter type.

  • Operator for Discrete ParametersThe comparison operator that will be used between the Field or Expression column value and a value in an SQL predicate or condition.

    • NoneUse this option when using a range parameter type.

    • Equal toCompare the equality of a field or expression to a value.

    • Not equal toTest whether a field or expression is not equal to a value.

    • Greater thanTest whether a field or expression is higher than a value.

    • Less thanTest whether a field or expression is lower than a value.

    • Include valuesDetermine whether a value from a field or expression matches any value in a list.

  • Default Discrete ParametersWhen using a discrete parameter type, you must provide a default value. When the operator is include values, you can provide multiple values separated by commas, for example VANDALISM,BURGLARY/THEFT.

  • Operator for Next ParametersThe logical operator between this operator and the next one. This column is only applicable when you have more than one parameter definition.

    • NoneUse this option when there are no more parameters

    • AndCombine two conditions and select a record if both conditions are true.

    • OrCombine two conditions and select a record if at least one condition is true.

Value Table

唯一标识符字段

(可选)

唯一标识符字段 将用于唯一标识表中各行的字段。

String

形状类型

(可选)

指定查询图层的形状类型。 在输出查询图层中只会使用查询结果集中与指定形状类型匹配的那些记录。 默认情况下,将使用结果集中第一条记录的 shape 类型。 如果查询结果集未返回几何字段,则忽略此参数。

  • 输出查询图层将使用点几何。

  • 多点输出查询图层将使用多点几何。

  • 输出查询图层将使用面几何。

  • 折线输出查询图层将使用折线几何。

String

空间参考 ID (SRID)

(可选)

返回几何查询的空间参考标识符 (SRID) 值。 在输出查询图层中只会使用查询结果集中与指定 SRID 值匹配的那些记录。 默认情况下,将使用结果集中第一条记录的 SRID 值。 如果查询结果集未返回几何字段,则忽略此参数。

String

坐标系

(可选)

输出查询图层将使用的坐标系。 默认情况下,将使用结果集中第一条记录的空间参考。 如果查询结果集未返回几何字段,则忽略此参数。

Spatial Reference

坐标包含 M 值

(可选)

指定输出图层是否包括线性测量(m 值)。

  • 选中图层将包括 m 值。

  • 未选中图层将不包括 m 值。 这是默认设置。

Boolean

坐标包含 Z 值

(可选)

指定输出图层是否将包括高程值(z 值)。

  • 选中图层将包括 z 值。

  • 未选中图层将不包括 z 值。 这是默认设置。

Boolean

范围

(可选)

指定图层范围。 范围必须包括表中的所有要素。

  • 当前显示范围 地图视图 - 范围基于活动地图或场景。

  • 绘制范围 构造直角并完成草图 - 范围将基于在地图或场景上绘制的矩形。

  • 图层范围 图层 - 范围基于活动地图图层。 选择可用图层或者使用所有图层中的数据范围选项。 每个地图图层具有以下选项:

    • 所有要素 全选 - 所有要素的范围。

    • 选定要素 选定要素的区域 - 选定要素的范围。

    • 可见要素 范围指示器 - 可见要素的范围。

  • 浏览 浏览 - 范围将基于数据集。

  • 剪贴板 粘贴 - 可在剪贴板中复制和粘贴范围。

    • 复制范围 复制 - 将范围坐标和坐标系复制到剪贴板。

    • 粘贴范围 粘贴 - 从剪贴板粘贴范围和坐标系。 如果剪贴板不包含坐标系,则范围将使用地图的坐标系。

  • 重置范围 重置 - 将范围重置为默认值。

当手动提供坐标时,坐标必须为数值,并且位于活动地图的坐标系中。 地图可能使用与提供的坐标不同的显示单位。 在南纬和西经坐标中使用负号。

Extent

环境

当前工作空间, 输出坐标系

许可信息

  • 基本: 否
  • 标准: 否
  • 高级: 是