arcgis.geometry.filters module

Functions to filter query results by a spatial relationship with another geometry Used when querying feature layers and imagery layers.

intersects

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

filters results whose geometry intersects with the specified geometry

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

# 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)

contains

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

Returns a feature if its shape is wholly contained within the search geometry. Valid for all shape type combinations.

crosses

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

Returns a feature if the intersection of the interiors of the two shapes is not empty and has a lower dimension than the maximum dimension of the two shapes. Two lines that share an endpoint in common do not cross. Valid for Line/Line, Line/Area, Multi-point/Area, and Multi-point/Line shape type combinations.

envelope_intersects

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

Returns features if the envelope of the two shapes intersects.

index_intersects

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

Returns a feature if the envelope of the query geometry intersects the index entry for the target geometry.

overlaps

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

Returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes. Applies to Area/Area, Line/Line, and Multi-point/Multi-point shape type combinations.

touches

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

Returns a feature if the two shapes share a common boundary. However, the intersection of the interiors of the two shapes must be empty. In the Point/Line case, the point may touch an endpoint only of the line. Applies to all combinations except Point/Point.

within

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

Returns a feature if its shape wholly contains the search geometry. Valid for all shape type combinations.