Returns a record set of features (geometry and attributes) that meet the query filter selection criteria for the specified layer id.
QueryFeatureData(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
A RecordSet
that contains an array of fields and records. All
fields will be returned. In addition, an FID field
is included and defines a unique integer id for each feature. A
SOAP exception will be thrown when the SQL expression in the query filter
is invalid.
Remarks
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.DefintionQuery property. To apply both query filters, the layer definition query expression and the new query filter will need to be combined for use with QueryFeatureData().
The number of records returned from a call
to the QueryFeatureData() method may be restricted by the map service.
The default maximum value for the number of results
returned is 500. If 600 records are matched, only
the first 500 results will be returned. The maximum number of results
cannot be changed via the ArcGIS Server SOAP API. The
map service itself must be configured to return more results, if necessary.
Note that the QueryFeatureCount() and QueryFeatureIDs()
methods are not restricted by this limitation. As
a result, you can determine the count and the feature ids of features
that meet the query filter criteria. To iterate
through blocks of results, use the QueryFilter.WhereClause to define a
constraint based on a set of feature ids. For
example, define a query filter with the where clause "CITYNAME =
'Washington'". Call the QueryFeatureIDs()
method to return a set of feature ids that match the query filter. The
feature id is a unique integer id for each feature. They
are stored in the FID field for each feature layer and maintained by the
map service. Before calling the QueryFeatureData()
method to return a record set, 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 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).
Joins established in the source map (one-to-one and many-to-one) are supported
using this method. Relates are not supported (one-to-many
and many-to-many).
Examples