title: How to use clusterProperties in mapbox-gl
body: <p>I built a mapbox-gl js (v0.52) map where points are getting aggregated into clusters; much like in the <a href="https://docs.mapbox.com/mapbox-gl-js/example/cluster/" rel="nofollow noreferrer">clusters example</a> from mapbox page.</p>
  
  <p>The cluster color needs to be a function of an aggregation of individual points properties: For simplicity, say each point has a <code>status</code> property, which determine its color, and the color of a cluster should just be the color corresponding to the <code>max</code> of each of its points' <code>status</code> values.</p>
  
  <p>Example geojson data would look like:</p>
  
  <pre><code>const geoData = {
    type: 'FeatureCollection',
    features: [
      {
        type: 'Feature',
        properties: {
          id: 'fakeid11',
          status: 20,
        },
        geometry: {
          type: 'Point',
          coordinates: [-151.5129, 63.1016, 0]
        }
      },
      {
        type: 'Feature',
        properties: {
          id: 'fakeid22',
          status: 10,
        },
        geometry: {
          type: 'Point',
          coordinates: [-150.4048, 63.1224, 105.5]
        }
      }
    ]
  };
  </code></pre>
  
  <p>I am trying to use <code>clusterProperties</code> to compute the aggregation as <a href="https://docs.mapbox.com/mapbox-gl-js/style-spec/#sources-geojson-clusterProperties" rel="nofollow noreferrer">described in the api docs</a>, similar to <a href="https://github.com/mapbox/mapbox-gl-js/blob/master/debug/cluster.html#L35" rel="nofollow noreferrer">this example from the source code</a>, to create this layer:</p>
  
  <pre><code>map.addSource('earthquakes', {
    type: 'geojson',
    data: geoData,
    cluster: true,
    clusterMaxZoom: 14, // Max zoom to cluster points on
    clusterRadius: 50, // Radius of each cluster when clustering points (defaults to 50)
    clusterProperties: {
      status: ['max', ['get', 'status']]
    }
  });
  </code></pre>
  
  <p>This snippet is exactly like the clusters example from mapbox page, just replacing the data by my static 2-elements copy, and adding <code>clusterProperties</code>.</p>
  
  <p>However this throws a validation error (a bit mangled from the minified mapbox-gl version):</p>
  
  <pre><code>Error: sources.earthquakes: unknown property "clusterProperties"
      at Object.Jr [as emitValidationErrors] (modules.js?hash=34588b9e7240c1a9b3fd2f8685e299d9dbbb40d9:504146)
      at De (modules.js?hash=34588b9e7240c1a9b3fd2f8685e299d9dbbb40d9:504150)
      at i._validate (modules.js?hash=34588b9e7240c1a9b3fd2f8685e299d9dbbb40d9:504150)
  </code></pre>
  
  <p>What is wrong with this <code>clusterProperties</code> usage? It would seem it is simply refusing to validate this property. Note that the map works ok (without the <code>status</code> aggregated property of course) if I comment the last 3 lines that set it.</p>