Find features in a feature table which match an SQL query.
Query expressions can be used in ArcGIS to select a subset of features from a feature table. This is most useful in large or complicated data sets. A possible use case might be on a feature table marking the location of street furniture through a city. A user may wish to query by a TYPE column to return "benches". In this sample, we query a U.S. state by STATE_NAME from a feature table containing all U.S. states.
Input the name of a U.S. state into the text field. When you click the button, a query is performed and the matching features are highlighted or an error is returned.
- Create a
ServiceFeatureTable
using the URL of a feature service. - Create a
QueryParameters
with a where clause specified using theWhereClause
property. - Perform the query using
QueryFeaturesAsync(query)
on the service feature table. - When complete, the query will return a
FeatureQueryResult
which can be iterated over to get the matching features.
- FeatureLayer
- FeatureQueryResult
- QueryParameters
- ServiceFeatureTable
This sample uses U.S. State polygon features from the USA 2016 Daytime Population feature service.
query, search