Map Service QueryFeatureIDs method

Queries and returns a set of feature ids that meet the query filter selection criteria for the specified layer id.

 

QueryFeatureIDs(string MapName, int LayerID, QueryFilter QueryFilter)

 

Parameter

Description

MapName

The name of the map (data frame) that contains the layer associated with the LayerID parameter.

LayerID

The layer id of the layer to query.

QueryFilter

An attribute or spatial query that defines the selection criteria for the layer associated with the LayerID parameter.

 

Return Value

 

An FIDSet that contains an array of integers. Each integer represents a unique identifier for each feature (FID) in the layer queried. The map service assigns FIDs to each feature in every feature layer it contains. A SOAP exception will be thrown if the SQL expression in the query filter is invalid.

 

Remarks

 

The array of integers contained by the FIDSet returned from this method is accessible via the FIDSet.FIDArray property. It is not restricted by limitations on the maximum number of results returned by a map service. The integer array can be used to define selected features in a layer for display in a map (LayerDescription.SelectionFeatures) or the extent of selected features (FeatureExtent.FeatureIDs).

 

Although the methods QueryFeatureData, QueryHyperlinks, Find and Identify are all restricted in the number of records they can return, this method offers a means to iterate through any number of results. Before calling a restricted query method, use this method to return a set of feature ids that match the query filter. Select a block of feature ids to constrain the existing query filter. For example, append the clause "AND FID IN (213, 228)" so only the features that have feature ids in this collection (213 and 228) will be returned. In this manner you can iterate through any size result set, as long as the block size is less than the maximum number of records a map service can return. In this example, the block size is two (two feature ids are included).

 

To determine which SQL query parameters can be used with a layer, use the GetSQLSyntaxInfo method.

 

The query filter will override any layer definition queries defined in the map service or defined via the LayerDescription.DefintionExpression property. To apply both query filters, the layer definition query expression and the new query filter will need to be combined for use with this method.

 

Examples

C#

VB.NET

Java