I am trying to calculate statistics for a feature layer. I can get the statistics for the entire layer using the sample code as a guide no problem. My question is can I filter the query based on a geometry and calculate statistics on that result. I need to be able to calculate statistics on the spatially selected subset of the feature layer. When I add the query.Geometry=SomeGeometry to the query of the querytask i get no results. Is this even possible, if so how?
Private Sub OutStatisticsDataGrid_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Dim query As New Query() With query .geometry = SomeGeometry
.GroupByFieldsForStatistics = New List(Of String) _ From {"SUB_REGION"} .OutStatistics = New List(Of OutStatistic) _ From {New OutStatistic() With { .OnStatisticField = "pop2000", .OutStatisticFieldName = "SubRegionPopulation", .StatisticType = StatisticType.Sum }, New OutStatistic() With { .OnStatisticField = "sub_region", .OutStatisticFieldName = "NumberOfStates", .StatisticType = StatisticType.Count } } End With queryTask.ExecuteAsync(query) End Sub
A statistics query will not work with a spatial filter in ArcGIS Server 10.1. We've added this function to the map service at 10.1 service pack 1. See the service pack announcement here. The bug number is NIM083547.
A statistics query will not work with a spatial filter in ArcGIS Server 10.1. We've added this function to the map service at 10.1 service pack 1. See the service pack announcement here. The bug number is NIM083547.