Select to view content in your preferred language

[4.30] Cluster count incorrect after using applyEdits on a feature layer

505
3
08-12-2024 06:56 AM
RyanMoser
Emerging Contributor

Hello,

I'm running into an issue where cluster counts are incorrect after using applyEdits on a feature layer at certain zoom levels. The feature layer uses the cluster feature reduction method.

For example, I start with a cluster of 15 features. There's a refresh that occurs every 60 seconds, which updates the properties of each feature in the layer. The applyEdits function is called and these updated features are provided to the updateFeatures argument like this:

 

 

 await featureLayer.applyEdits({
     updateFeatures: updatedFeatures
 });

 

 

When the refresh completes, all appears to be well. The cluster of 15 features is still there. If I zoom in, it breaks into two clusters of 4 and 11. However, the cluster labels for these will say 8 and 22. If I zoom in a little bit more, the cluster labels go back to their correct count. If I zoom in again, they switch back to the incorrect count, and so on. 

So it seems that zooming in and out alternates between cluster labels being correct and incorrect. This only happens after using applyEdits during the refresh. When the labels are incorrect, their value usually double the correct amount. I can click the cluster with a label of 22 and see that it actually contains 11 via the popup. 

Is this a known issue, or am I perhaps doing something incorrectly? I have screenshots of this behavior, but it seems I'm not allowed to post images. I can also provide more code if needed, but that could take a while to adapt for a post, so I'm trying to see if there's any "easy" answer first. Thanks!

3 Replies
RyanMoser
Emerging Contributor

I have reproduced this behavior in a small CodePen application: https://codepen.io/rmoser3/pen/poXpKxm

This application creates a feature layer with cluster feature reduction. To reproduce the bug:

  1.  Navigate to the feature set. They should be visible from the start, but if not, they're in the US state of Georgia. 
  2. There's a refresh that occurs every 10 seconds. This refresh simply updates the name of one of the features and then calls applyEdits. After the first refresh, start zooming all the way in (until each feature is on its own) and then all the way back out (until one cluster is visible). If it doesn't happen the first time, keep zooming in and out, you will eventually see an incorrect value. There are 5 features. Any combination that doesn't equal 5 is incorrect.

Can anyone please tell me if this is something I'm doing wrong or if this is a defect in the API?

0 Kudos
michaelkdev
Regular Contributor

Hi Ryan, It looks like I'm having the the same issues?

https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-clustering-count-not-correct...

Hope they will find a solution!

It works with version 4.29

RyanMoser
Emerging Contributor

Thanks for the response! Glad we're not the only one. Will definitely keep an eye out for the resolution. 

0 Kudos