Hello!
I am currently adding points onto a map by looping through an array of latitudes and longitudes. I was wondering how I would cluster this on the map, so that it doesn't display as an individual point?
This is the code:
var graphicsLayer = new GraphicsLayer();
webmap.layers.add(graphicsLayer);
var simpleMarkerSymbol = {
type: "simple-marker", //
color: [226, 119, 40], // orange
size: 30,
style: "circle",
outline: {
color: [255, 255, 255], // white
width: 2
}
};
for (i=0; i< zLongitude.length; i++ ){
// Create a point
var point = {
type: "point",
longitude: zLongitude[i],
latitude: zLatitude[i],
};
var pointGraphic = new Graphic({
geometry: webMercatorUtils.geographicToWebMercator(point),
symbol: simpleMarkerSymbol
});
graphicsLayer.add(pointGraphic);
}
Clustering isn't supported in GraphicsLayer. You can add your features to a client-side FeatureLayer with featureReduction.
Here's a sample