HI,
I am trying to create a cluster layer and plot it on map using simple marker but I am not able to plot this layer on map. No errors are being shows while running the application. Below is the code. Can someone help me if I am missing something.
const clusterConfig = {
type: "cluster",
clusterRadius: "100px",
// {cluster_count} is an aggregate field containing
// the number of features comprised by the cluster
popupTemplate: {
title: "Cluster summary",
content: "This cluster represents {cluster_count} earthquakes.",
fieldInfos: [
{
fieldName: "cluster_count",
format: {
places: 0,
digitSeparator: true
}
}
]
},
clusterMinSize: "24px",
clusterMaxSize: "60px",
labelingInfo: [
{
deconflictionStrategy: "none",
labelExpressionInfo: {
expression: "Text($feature.cluster_count, '#,###')"
},
symbol: {
type: "text",
color: "#004a5d",
font: {
weight: "bold",
family: "Noto Sans",
size: "12px"
}
},
labelPlacement: "center-center"
}
]
};
this.clusterLayer = new FeatureLayer({
supportsEditing: true,
title: "clusters",
objectIdField: "OBJECTID",
id: "clusters",
source: [this.clustPoints],
geometryType: "point",
spatialReference: { wkid: 4326 },
featureReduction: clusterConfig,
renderer: {
type: "simple",
symbol: {
type: "simple-marker",
size: 4,
color: "#fc3232",
outline: {
color: [50, 50, 50]
}
}
}
});
this.map.add(this.clusterLayer);
this.showClusterLayer();
Thanks
Aditya Kumar
Solved! Go to Solution.
Thanks for writing. I was able to solve it. The problem was with the source cluster points. All the points had x,y in a different projection. I had to use xyToLngLat (x, y) in order to solve it and now the clusters are getting plotted.
Thanks
Aditya Kumar
Can you post a link to a codepen demonstrating the issue. It's hard to debug without seeing this config connected to real data.
Thanks for writing. I was able to solve it. The problem was with the source cluster points. All the points had x,y in a different projection. I had to use xyToLngLat (x, y) in order to solve it and now the clusters are getting plotted.
Thanks
Aditya Kumar