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


Python ArcGIS intersects用法及代碼示例


本文簡要介紹 python 語言中 arcgis.geometry.filters.intersects 的用法。

用法:

arcgis.geometry.filters.intersects(geometry, sr=None)

返回:

一個字典

intersects 方法過濾幾何與指定的 Geometry 對象相交的結果。

Keys

Description

geometry

任何類型的單個 Geometry 。幾何結構與ArcGIS REST API 返回的 JSON 幾何對象的結構相同。不支持使用簡單語法。

spatial_ref

輸入幾何圖形的 SpatialReference 眾所周知的 ID 或 JSON 對象

例子:

# USAGE EXAMPLE: Select the gas lines that intersect a specific
freeway feature, United States Interstate 15.

from arcgis.geometry import Geometry
from arcgis.geometry.filters import intersects

# get a feature layer item from the gis
>>> flyr_item = gis.content.search("Freeways*", "Feature Layer")[0]
>>> freeway_lyr = flyr_item.layers[0]

# assign a variable to the spatial reference
>>> freeway_sr = freeway_lyr.properties.extent["spatialReference"]

# select a filter feature to construct its geometry
>>> rte15_fset = freeway_lyr.query(where="ROUTE_NUM = 'I15'")
>>> rte15_geom_dict = rte15_fset.features[0].geometry
>>> rte15_geom_dict['spatialReference'] = freeway_sr
>>> rte15_geom = Geometry(rte15_geom_dict)

# construct a geometry filter using the filter geometry
>>> flyr_filter = intersects(rte15_geom, sr=freeway_sr)

# query a feature layer for features that meet filter criteria
>>> gas_lines_I15 = gas_line_lyr.query(geometry_filter=flyr_filter)

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.geometry.filters.intersects。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。