ExecuteQuery

This method returns all the features in a layer that have a specified attribute value. When a combined attribute and spatial query is required, an IGeometry parameter can be defined that filters the returned features by a selection area geometry in addition to the attribute value. When splitting a large query into multiple “sub-queries” using the NumOfFeatures parameter (to prevent excessively long response time), the FromDataSourceFeatureId parameter for each subsequent call to ExecuteQuery should be set equal to the ID of the last feature returned in the previous call. This method executes synchronously, meaning it returns after the query is executed. If you want to execute asynchronously, use ExecuteQueryAsync instead.

Note:    When only a spatial query is required, “ExecuteSpatialQuery” can be called instead. Note that in addition to combining the spatial query with an attribute query, ExecuteQuery also offers the advantages of performing the query without rendering and of splitting the request into chunks (multiple “sub-queries”, each on a defined subset of the features). ExecuteSpatialQuery, on the other has the advantage of rendering all the data in the 3D Window. SeeExecuteSpatialQuery” for more information.

Note:    In Javascript, if you do not want to use an area filter, you can call ICreator80. GeometryCreator.CreatePolygonGeometry(null)) to create a null IGeometry object.

 

JavaScript

 

ExecuteQuery(

       AttributeFilter,

       NumOfFeatures,

       FromDataSourceFeatureId,

       AreaFilter)

 

C#

 

IFeatures80 ExecuteQuery(

       string AttributeFilter,

       int NumOfFeatures = -1,

       string FromDataSourceFeatureId = "",

       IGeometry* AreaFilter = null)

 

C++

 

HRESULT ExecuteQuery(

       BSTR AttributeFilter,

       long NumOfFeatures,

       BSTR FromDataSourceFeatureId,

       IGeometry* AreaFilter,

       IFeatures80** pITerraExplorerObject)

Parameters

AttributeFilter

Any valid SQL WHERE clause that filters the layer’s features, thereby designating which of the layer’s features should be queried.

NumOfFeatures

The maximum number of features to return. This property can have a significant impact on the method’s execution speed.

FromDataSourceFeatureId

The ID of the first feature that should be returned. When splitting a large query into multiple “sub-queries” using the NumOfFeatures parameter (to prevent excessively long response time), the FromDataSourceFeatureId for each subsequent call to ExecuteQuery should be set equal to the ID of the last feature returned in the previous call.

AreaFilter

An IGeometry representing the polygon, multipolygon, or linear ring that designates which part of the layer should be selected (only layer features that are spatially related to the polygon/ multipolygon/ linear ring will be selected).  

Note:    In Javascript, if you do not want to use an area filter, you can call ICreator80. GeometryCreator.CreatePolygonGeometry(null)) to create a null IGeometry object.

Return Value

pIFeatures

An IFeatures80, containing all the features returned by the attribute (and spatial) query. This method executes synchronously, meaning it returns after the query is executed. If you want to execute asynchronously, use ExecuteQueryAsync instead.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.