diff --git a/debug/cluster.html b/debug/cluster.html
index 019160c9409..612c0b5b0f1 100644
--- a/debug/cluster.html
+++ b/debug/cluster.html
@@ -20,7 +20,7 @@
var map = window.map = new mapboxgl.Map({
container: 'map',
- zoom: 0,
+ zoom: 1,
center: [0, 0],
style: 'mapbox://styles/mapbox/cjf4m44iw0uza2spb3q0a7s41',
hash: true
@@ -31,7 +31,12 @@
"type": "geojson",
"data": "/test/integration/data/places.geojson",
"cluster": true,
- "clusterRadius": 50
+ "clusterRadius": 50,
+ "clusterProperties": {
+ "max": ["max", 0, ["get", "scalerank"]],
+ "sum": ["+", 0, ["get", "scalerank"]],
+ "has_island": ["any", false, ["==", ["get", "featureclass"], "island"]]
+ }
});
map.addLayer({
"id": "cluster",
@@ -39,7 +44,7 @@
"source": "geojson",
"filter": ["==", "cluster", true],
"paint": {
- "circle-color": "rgba(0, 200, 0, 1)",
+ "circle-color": ["case", ["get", "has_island"], "orange", "rgba(0, 200, 0, 1)"],
"circle-radius": 20
}
});
@@ -49,7 +54,7 @@
"source": "geojson",
"filter": ["==", "cluster", true],
"layout": {
- "text-field": "{point_count}",
+ "text-field": "{point_count} ({max})",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-size": 12,
"text-allow-overlap": true,
diff --git a/src/source/geojson_source.js b/src/source/geojson_source.js
index c82d2589467..cfcf397ae8c 100644
--- a/src/source/geojson_source.js
+++ b/src/source/geojson_source.js
@@ -139,7 +139,8 @@ class GeoJSONSource extends Evented implements Source {
extent: EXTENT,
radius: (options.clusterRadius || 50) * scale,
log: false
- }
+ },
+ clusterProperties: options.clusterProperties
}, options.workerOptions);
}
diff --git a/src/source/geojson_worker_source.js b/src/source/geojson_worker_source.js
index d8219e90880..cb569e8650a 100644
--- a/src/source/geojson_worker_source.js
+++ b/src/source/geojson_worker_source.js
@@ -10,6 +10,7 @@ import Supercluster from 'supercluster';
import geojsonvt from 'geojson-vt';
import assert from 'assert';
import VectorTileWorkerSource from './vector_tile_worker_source';
+import { createExpression } from '../style-spec/expression';
import type {
WorkerTileParameters,
@@ -30,7 +31,8 @@ export type LoadGeoJSONParameters = {
source: string,
cluster: boolean,
superclusterOptions?: Object,
- geojsonVtOptions?: Object
+ geojsonVtOptions?: Object,
+ clusterProperties?: Object
};
export type LoadGeoJSON = (params: LoadGeoJSONParameters, callback: ResponseCallback