Find min and max values of a field (column) in a feature layer

566
1
05-11-2022 10:04 AM
Maxycle
New Contributor

I am using ArcGIS API for Javascript in a Nuxt application and I would like to find the max and min values of a field in a feature layer hosted on ArcGIS. How to do that ?? The values for the stops for the visualVariables are hard coded and I would like them to be dynamic and take the min and max values of the field.

 

Tags (2)
0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor

You can use StatisticDefinition with the query.outStatistics to get the min/max values.

https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-StatisticDefinition....

You can search for "statistics" in the Sample Code page and find a number of samples including this one.

https://developers.arcgis.com/javascript/latest/sample-code/popup-customcontent/