Esri / arcgis-rest-js

compact, modular JavaScript wrappers for the ArcGIS REST API
https://developers.arcgis.com/arcgis-rest-js/
Apache License 2.0
353 stars 121 forks source link

fix(arcgis-rest-feature-service): add additional statistic types #1114

Closed gavinr-maps closed 1 year ago

gavinr-maps commented 1 year ago

1043

These are currently supported in ArcGIS Online hosted feature services, but not in ArcGIS Enterprise. So these are not yet in the ArcGIS REST API Documentation because they are not supported in ArcGIS Enterprise yet. But due to the request in #1043 and also the fact that they are built into other client libraries like the ArcGIS Maps SDK for JavaScript, we think it's valid to put these types into ArcGIS REST JS.

Demo

Because these are not in the REST API documentation yet, I had to look up what are the actual string names. They can be found in the JSON info of a Feature Service layer, for example here - scroll down to the supportedSpatialAggregationStatistics: image

Also, to verify these are correct, I constructed a test REST call - here is an example using EnvelopeAggregate:

https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Major_Cities_/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&groupByFieldsForStatistics=STATE_ABBR&outStatistics=%5B%0D%0A++%7B%0D%0A++++%22statisticType%22%3A+%22AVG%22%2C%0D%0A++++%22onStatisticField%22%3A+%22POPULATION%22%2C%0D%0A++++%22outStatisticFieldName%22%3A+%22avg_pop%22%0D%0A++%7D%2C%0D%0A++%7B%0D%0A++++%22statisticType%22%3A+%22EnvelopeAggregate%22%2C%0D%0A++++%22outStatisticFieldName%22%3A+%22aggregateExtent%22%0D%0A++%7D%0D%0A%5D&f=html

codecov[bot] commented 1 year ago

Codecov Report

Merging #1114 (e6f34af) into main (170c450) will not change coverage. Report is 4 commits behind head on main. The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #1114   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          163       163           
  Lines         3003      3003           
  Branches       534       534           
=========================================
  Hits          3003      3003           
Files Changed Coverage Δ
...ackages/arcgis-rest-feature-service/src/helpers.ts 100.00% <ø> (ø)