You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"This sample demonstrates how to query a feature table, in this case returning a count, for features that are within the visible extent or that meet specified criteria.",
27
+
"Zoom to features matching a query and countfeatures in the visible extent.",
28
28
"Use the button to zoom to the extent of the state specified (by abbreviation) in the textbox or use the button to count the features in the current extent.")]
29
29
publicclassQueryFeatureCountAndExtent:Activity
30
30
{
31
-
// Search box for state entry
31
+
// UI controls.
32
32
privateEditText_myStateEntry;
33
-
34
-
// Label for results
35
33
privateTextView_myResultsLabel;
36
-
37
-
// Button for querying cities by state
38
34
privateButton_myQueryStateButton;
39
-
40
-
// Button for querying cities within the current extent
This sample demonstrates how to query a feature table, in this case returning a count, for features that are within the visible extent or that meet specified criteria.
3
+
Zoom to features matching a query and count the features in the current visible extent.
Use the button to zoom to the extent of the state specified (by abbreviation) in the textbox or use the button to count the features in the current extent.
10
+
11
+
## How it works
12
+
13
+
Querying by state abbreviation:
14
+
15
+
1. A `QueryParameters` object is created with a `WhereClause`.
16
+
2.`FeatureTable.QueryExtentAsync` is called with the `QueryParameters` object to obtain the extent that contains all matching features.
17
+
3. The extent is converted to a `Viewpoint`, which is passed to `MapView.SetViewpointAsync`.
18
+
19
+
Counting features in the current extent:
20
+
21
+
1. The current visible extent is obtained from a call to `MapView.GetCurrentViewpoint(ViewpointType)`.
22
+
2. A `QueryParameters` object is created with the visible extent and a defined `SpatialRelationship` (in this case 'intersects').
23
+
3. The count of matching features is obtained from a call to `FeatureTable.QueryFeatureCountAsync`.
24
+
25
+
## Relevant API
26
+
27
+
*`QueryParameters`
28
+
*`QueryParameters.WhereClause`
29
+
*`QueryParameters.Geometry`
30
+
*`QueryParameters.SpatialRelationship`
31
+
*`FeatureTable.QueryExtentAsync`
32
+
*`FeatureTable.QueryFeatureCountAsync`
33
+
*`MapView.GetCurrentViewpoint(ViewpointType)`
34
+
35
+
## About the data
36
+
37
+
[See the layer on ArcGIS Online](https://www.arcgis.com/home/item.html?id=c8810b20c01b4e8ba5cd848966a66d7b)
38
+
39
+
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.
"This sample demonstrates how to query a feature table, in this case returning a count, for features that are within the visible extent or that meet specified criteria.",
21
+
"Zoom to features matching a query and countfeatures in the visible extent.",
22
22
"Use the button to zoom to the extent of the state specified (by abbreviation) in the textbox or use the button to count the features in the current extent.")]
0 commit comments