how to retain layer original symbol if single feature else create cluster symbol

1161
11
Jump to solution
03-07-2022 10:08 PM
ShefaliMantri
New Contributor III

Hello Team,

I have a simple picture marker symbol feature layer.

Requirement - When we turn ON cluster for that layer if single feature, then it should display layer original picture marker symbol and if more than 2 features, then it should display cluster symbol (simple marker symbol) with labels. When we turn OFF cluster, then layer will display as its initial state i.e. only picture marker symbols

 

0 Kudos
1 Solution

Accepted Solutions
Lerman
by
Occasional Contributor
11 Replies
MichaelVolz
Esteemed Contributor

Also interested in knowing if this is possible.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

You can use the layer' queryFeatureCount method to get the count of features in the service/layer. Then you apply Clustering or remove the clustering and apply the original renderer based on the count returned from the method. 

Here is a simple test app showcases how this can be done. But please note that it is a contrived app: https://codepen.io/U_B_U/pen/yLPWEgZ?editors=1000

0 Kudos
ShefaliMantri
New Contributor III

Thank you @UndralBatsukh for responding.

Requirement is when a cluster is ON and on the map some feature is single, some are not. When single feature on the map, then it shows layer original symbol, i.e. picture marker and club features shown as cluster simple circle with labels.

So at same time both picture and simple marker symbols will present on map for same layer.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Oh doh! Completely missed the point.  🙂 Sorry about that. 

This is not possible currently. We do have plans to support this scenario. I will update you once we add support for this. 

-Undral

0 Kudos
ShefaliMantri
New Contributor III

Ok @UndralBatsukh 

Thank you

0 Kudos
Lerman
by
Occasional Contributor
ShefaliMantri
New Contributor III

Yes@Lerman 

Thank you

0 Kudos
MichaelVolz
Esteemed Contributor

Can you please explain how you did this in words as this is the behavior I am also looking for with clustering when using a unique value renderer?

0 Kudos
ShefaliMantri
New Contributor III

In my project we have simple renderer feature layers and a toggle button to turn ON/OFF cluster. When cluster is ON, I replaced layer simple renderer to class break renderer as shown in https://codepen.io/xiej/pen/oNpLyJY 

0 Kudos