Select to view content in your preferred language

Cluster Layer not visible on map.

415
2
Jump to solution
12-21-2022 08:42 AM
ADITYAKUMAR1
Frequent Contributor

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

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ADITYAKUMAR1
Frequent Contributor

@KristianEkenes ,

  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

View solution in original post

0 Kudos
2 Replies
KristianEkenes
Esri Regular Contributor

Can you post a link to a codepen demonstrating the issue. It's hard to debug without seeing this config connected to real data.

0 Kudos
ADITYAKUMAR1
Frequent Contributor

@KristianEkenes ,

  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

0 Kudos