I have a graphic layer.
I want to cluster this data and display cluster on map(Arcgis JavaScript 3.x)
Any idea?
Hi Aditya,
Here are some samples for clustering in 3x:
Hi Ben,
clusterLayer = new ClusterLayer({ "data": photoInfo.data, "distance": 100, "id": "clusters", "labelColor": "#fff", "labelOffset": 10, "resolution": map.extent.getWidth() / map.width, "singleColor": "#888", "singleTemplate": popupTemplate });
In my case what will be the data?
Thanks
Kumar
This is how I would turn on clustering
var layer = new FeatureLayer(serviceUrl, {
featureReduction: {
type: "cluster"
}
})
Here is a simple sample to demonstrate the code above
Hi ADITYA KUMAR, the data will be
photoInfo.data = arrayUtils.map(resp, function(p) {
var latlng = new Point(parseFloat(p.lng), parseFloat(p.lat), wgs);
var webMercator = webMercatorUtils.geographicToWebMercator(latlng);
var attributes = {
"Caption": p.caption,
"Name": p.full_name,
"Image": p.image,
"Link": p.link
};
return {
"x": webMercator.x,
"y": webMercator.y,
"attributes": attributes
};
so basically an array with the following structure.
{
"x": 120,
"y": -32,
"attributes": {
"Caption": "caption",
"Name": "a name",
"Image": small.jpg,
"Link": "http link"
}
};
Is it possible to add clustering to graphics layer in version 4.27 ?
featureReduction props is not available in the docs also.
Is it possible to have clustering if it has only points geometry in graphics layer ? i know Polygon and Line string is not supported