This document is archived and information here might be outdated. Recommended version. |
Provides access to members that return and modify the type of spatial relationship that the filter will use.
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.
Name | Description | |
---|---|---|
AddField | Appends a single field name to the list of sub-fields. | |
FilterOwnsGeometry | Indicates whether the filter owns the query geometry. | |
Geometry | The query geometry used to filter results. | |
GeometryEx | The query geometry used to filter results. | |
GeometryField | The name of the Geometry field to which the filter applies. | |
OutputSpatialReference | The spatial reference in which to output geometry for a given field. | |
SearchOrder | The search order used by the filter. | |
SpatialRel | The spatial relationship checked by the filter. | |
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. | |
SubFields | The comma delimited list of field names for the filter. | |
WhereClause | The where clause for the filter. |
Interfaces | Description |
---|---|
IQueryFilter | Provides access to members that filter data based on attribute values and or relationships. |
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 |
IQueryDef Interface | IQueryFilter Interface | IFeatureClass.Search Method | IQueryFilter Interface | IQueryDef Interface | IFeatureClass.GetFeatures Method | IFeatureClass.FeatureCount Method | IQueryFilter Interface