Zoom to features matching a query and count the features in the current visible extent.
Use the button to zoom to the extent of a state or use the button to count the features in the current extent.
Querying by state abbreviation:
- A
QueryParameters
object is created with aWhereClause
. FeatureTable.QueryExtentAsync
is called with theQueryParameters
object to obtain the extent that contains all matching features.- The extent is converted to a
Viewpoint
, which is passed toMapView.SetViewpointAsync
.
Counting features in the current extent:
- The current visible extent is obtained from a call to
MapView.GetCurrentViewpoint(ViewpointType)
. - A
QueryParameters
object is created with the visible extent and a definedSpatialRelationship
(in this case 'intersects'). - The count of matching features is obtained from a call to
FeatureTable.QueryFeatureCountAsync
.
QueryParameters
QueryParameters.WhereClause
QueryParameters.Geometry
QueryParameters.SpatialRelationship
FeatureTable.QueryExtentAsync
FeatureTable.QueryFeatureCountAsync
MapView.GetCurrentViewpoint(ViewpointType)
See the layer on ArcGIS Online
This map shows hospital spending per-patient for common incidents. Hospitals in blue/turquoise spend less than the national average. Red/salmon indicates higher spending relative to other hospitals, while gray is average.
Feature layer, Feature table, Query, Medicare