当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python ArcGIS RasterCollection.filter_by_attribute用法及代码示例


本文简要介绍 python 语言中 arcgis.raster.RasterCollection.filter_by_attribute 的用法。

用法:

filter_by_attribute(field_name, operator, field_values, context=None)

返回:

仅包含满足过滤器的项目的 RasterCollection 对象

filter_by_attribute 方法通过属性查询过滤栅格项目的集合,并返回仅包含满足查询的项目的栅格集合。

Parameter

Description

field_name

必需的字符串。要在过滤器中使用的字段名称。

operator

必需的字符串。过滤属性的关键字。关键字包括以下内容:

  • CONTAINS - The attribute in the field contains the specified string, list, or number.

  • ENDS_WITH - The attribute ends with the specified string or number.

  • EQUALS - The attribute equals the specified string, list, or number.

  • GREATER_THAN - The attribute is greater than the specified number.

  • IN - The attribute is one of the items in the specified list.

  • LESS_THAN - The attribute is less than the specified number.

  • NOT_CONTAINS - The attribute does not contain the specified string, list, or number.

  • NOT_ENDS_WITH - The attribute does not end with the specified string or number.

  • NOT_EQUALS - The attribute does not equal the specified string, list, or number.

  • NOT_GREATER_THAN - The attribute is not greater than the specified number.

  • NOT_IN - The attribute is not one of the items in the specified list.

  • NOT_LESS_THAN - The attribute is not less than the specified number.

  • NOT_STARTS_WITH - The attribute does not start with the specified string or number.

  • STARTS_WITH - The attribute starts with the specified string or number.

field_values

必需的对象。要比较的一个或多个属性值。这可以指定为字符串、列表或数字。

context

可选字典。用于控制 RasterCollection 创建的其他属性。上下文参数的默认值将与应用于父集合的上下文设置的默认值相同。

目前可用:

  • query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.

    • True: Set query_boundary to True to add the SHAPE field to the RasterCollection.

    • False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)

    Example:

    {“query_boundary”:True}

例子:

# Usage Example 1: Filters the raster collection based on matching field name.

filtered_rc_attribute = rc.filter_by_attribute(field_name="Name",
                                               operator="EQUALS",
                                               field_values="field_values")

# Usage Example 2: Filters the raster collection based on unmatching field name.

filtered_rc_attribute2 = rc.filter_by_attribute(field_name="Name",
                                                operator="NOT_EQUALS",
                                                field_values="field_values")

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.raster.RasterCollection.filter_by_attribute。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。