ArcObjects Library Reference (GeoDatabase)  

ISpatialFilter Interface

Provides access to members that return and modify the type of spatial relationship that the filter will use.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

ISpatialFilter is a QueryFilter that includes both spatial and attribute constraints.  Therefore, a SpatialFilter can be used to restrict the set of features retrieved from a feature class using both spatial and attribute restrictions.  ISpatialFilter inherits from IQueryFilter so you can optionally specify a string defining a where clause, include a list of columns to be retrieved or specify the spatial reference in which to output the geometry of the resulting features. See the IQueryFilter interface for help on the inherited methods and properties.

The most common ways to perform a spatial query using a spatial filter is to create the spatial filter using this interface and use it as a parameter for IFeatureClass::Search, IFeatureClass::Select or similar methods on feature layers, selection sets, etc.

The Geometry and SpatialRel properties are required.

Geometry is the source geometry in relation to which the spatial selection will be performed. GeometryField is a string corresponding to the name of the field containing the geometries to be compared to the source geometry. Finally the spatial relationship is specified with the SpatialRel property passing it an esriSpatialRelEnum .

A SearchOrder can be specified using an esriSearchOrder. When an attribute query is specified it will specify which of the attritute or spatial part of the query is executed first. A judicious choice may significantly improve the performances. This is only available with SDE datasources.

The SpatialRelDescription can optionally be populated with a string to define spatial relationships that are not possible using the esriSpatialRelEnum values. In this case the SpatialRel parameter must be set to esriSpatialRelRelation. See the help on the SpatialRelDescription property for details on string formatting.

The esriGeometry library provides other ways to perform a spatial selection. See, for instance, the example associated with ITopologicalOperator that performs a spatial selection on polylines that share a line segment.

Members

Description
Method AddField Appends a single field name to the list of sub-fields.
Read-only property FilterOwnsGeometry Indicates whether the filter owns the query geometry.
Read/write property Geometry The query geometry used to filter results.
Write-only property GeometryEx The query geometry used to filter results.
Read/write property GeometryField The name of the Geometry field to which the filter applies.
Read/write property OutputSpatialReference The spatial reference in which to output geometry for a given field.
Read/write property SearchOrder The search order used by the filter.
Read/write property SpatialRel The spatial relationship checked by the filter.
Read/write property SpatialRelDescription The array elements which describe the spatial relation between the query geometry and the requested geometries. There are 9 chars in this string which can be either 'F', 'T' or '*'; e.g., TT*FFT***' represents CONTAIN.
Read/write property SubFields The comma delimited list of field names for the filter.
Read/write property WhereClause The where clause for the filter.

Inherited Interfaces

Interfaces Description
IQueryFilter Provides access to members that filter data based on attribute values and or relationships.

CoClasses that implement ISpatialFilter

CoClasses and Classes Description
ImageQueryFilter (esriCarto) An image query filter.
SpatialFilter Esri Spatial Filter object.
TemporalQueryFilter (esriTrackingAnalyst) Controls properties for the temporal query filter.
TimeQueryFilter (esriCarto) TimeQueryFilter Class

See Also

IQueryDef Interface | IQueryFilter Interface | IQueryDef Interface | IFeatureClass.FeatureCount Method | IFeatureClass.GetFeatures Method | IQueryFilter Interface | IFeatureClass.Search Method | IQueryFilter Interface