Returns the IDs of the features that meet the query filter selection criteria for the specified layer.
[Visual Basic .NET] Public Function QueryFeatureIDs ( _ ByVal MapName As String, _ ByVal LayerID As Integer, _ ByVal Filter As IQueryFilter _ ) As IFIDSet
[C#] public IFIDSet QueryFeatureIDs ( string MapName, int LayerID, IQueryFilter Filter );
[C++]
HRESULT QueryFeatureIDs(
BSTR MapName,
long LayerID,
IQueryFilter* Filter,
IFIDSet** FIDs
);
[C++]Parameters
MapName [in] MapName is a parameter of type BSTR LayerID [in] LayerID is a parameter of type long Filter [in]Filter is a parameter of type IQueryFilter
FIDs [out, retval]FIDs is a parameter of type IFIDSet
Product Availability
Remarks
QueryFeatureIDs returns the IDs (FIDSet) of map features that match the parameters of a given query filter.
QueryFeatureIDs requires a number of input parameters. These include: a MapName, LayerID, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.
QueryFilter
QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid non-GIS data specific SQL statement. For example, CNTRY_CODE = BD or POPULATION = 12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName> = date YYYY-MM-DD; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific databases help.
SearchShape
Geometry set in ISpatialFilter should meet the following criteria:
- It should have the Spatial Reference System defined. In cases where it is not defined, the coordinate system is assumed to be in DataFrames coordinate system
- It must be one of the high-level geometries i.e. Point, Multipoint, Polyline, Polygon or Multipatch. Low-level geometry e.g. BezierCurve, CircularCurve must be wrapped into a high-level geometry
- It must be topologically correct. For more information, see help on IPolygon and ITopologicalOperator::Simplify .
Miscellaneous
MaxRecordCount does not affect QueryFeatureIDs or QueryFeatureIDs2.
There are two key differences between Find and QueryFeatureIDs. The first is that Find can work on multiple layers while the query methods work with a single layer. The second is that Find only works with a search string. The query methods use a queryFilter as a parameter. This allows the query to be based on either an attribute filter (SQL expression) or a spatial filter.
The results of this function can be used with LayerDescription::SelectionFeatures to display the selection in the exported image.