當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。