Select to view content in your preferred language

Using SummaryStatistics for binning data representation.

399
2
Jump to solution
04-24-2023 02:43 AM
GIS_test
New Contributor II

Hi to everyone,

I have a data representation using bins (featureReduction/Type binning).

I would like to be able to use the summary statistics function to obtain the Min and Max values. The idea is to use them as STOPS in my representation.

I have tried the following code:

 

const featureLayer =

const featureReduction =

const map = new Map({
    basemap: "gray-vector",
    layers: [featureLayer]
    });

  const view = new MapView({
  container: "viewDiv",
  map: map,
  center: [2.333333,48.866667],
  scale: 144447,
  constraints: {
      snapToZoom: false
  }
  });
const my_stats = summaryStatistics({
    layer: featureLayer,
    view,
    field: "aggregate",
    forBinning: true
  });

 

 

How can I use the SummaryStatistics function before declaring the Map and View (as I have tried but without success)  ?

 

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

You cannot use SummaryStatistics for binning before first creating the bins in a view. The binning implementation is purely client-side, so the bins must first be created before they can be queried for statistics. You can use SummaryStatistics to query a feature layer that hasn't yet been added to a map because the statistics query can be sent to the feature server. Because we don't have a server-side binning solution at the moment, the same cannot be done here.

If you're trying to query stats before bins display, I suggest you create the bins with a transparent symbol first, then issue the query and create the renderer and apply to the feature reduction object. That way you won't see flashing when the app starts up.

View solution in original post

2 Replies
KristianEkenes
Esri Regular Contributor

You cannot use SummaryStatistics for binning before first creating the bins in a view. The binning implementation is purely client-side, so the bins must first be created before they can be queried for statistics. You can use SummaryStatistics to query a feature layer that hasn't yet been added to a map because the statistics query can be sent to the feature server. Because we don't have a server-side binning solution at the moment, the same cannot be done here.

If you're trying to query stats before bins display, I suggest you create the bins with a transparent symbol first, then issue the query and create the renderer and apply to the feature reduction object. That way you won't see flashing when the app starts up.

GIS_test
New Contributor II

Thank you, it solved my problem well.


One last point that is still strange, I noticed that once the application is open in certain areas, the values ​​change when zooming in or out. Do you have any idea on how to make the display static and not dynamic ?

0 Kudos