Query Top Features
This sample demonstrates how to use the QueryTopFeatures() method on a FeatureLayer to query the most or the least visited national parks in each state for a given year or total of all time.
About this sample
This GeoBlazor sample, written in Blazor for .NET developers, demonstrates the QueryTopFeatures method from the ArcGIS Maps SDK for JavaScript via GeoBlazor's FeatureLayer.QueryTopFeatures, TopFeaturesQuery, and TopFilter APIs. The page shows a 2D map of the contiguous United States at zoom level 3, with a FeatureLayer of national parks rendered as small tree-emoji PictureMarkerSymbols. A Calcite panel anchored to the right side of the map presents the controls: a horizontal radio group to choose 'Most visited' (descending) or 'Least visited' (ascending), a select for how many parks to return per state (1, 2, or 3), and a select for the time range (Total of all time, 2018, 2019, or 2020). Two buttons — 'Query parks' (solid when active) and 'Clear query' — run the query or reset. Running the query calls QueryTopFeatures using a TopFilter grouped by State, ordered by the chosen field/direction, and applies a FeatureFilter on the FeatureLayerView so only the top matching parks remain visible. Results render as a Calcite list below the form, each item labeled with the park name plus visitor count and state; clicking a result opens that park's popup on the map. The sample is intended to demonstrate group-wise top-N feature queries in a Blazor application without writing JavaScript.