android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

Clustering should support diff util

Open MikolajKakol opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. My map has millions of points so I cannot add all of them at once. Hence what map moves I download items only visible on screen. When user does only small map movements points and clusters flicker and animations looks bad. This is because current implementation look like this:

    LaunchedEffect(itemsState) {
        snapshotFlow { itemsState.value.toList() }
            .collect { items ->
                clusterManager.clearItems()
                clusterManager.addItems(items)
                clusterManager.cluster()
            }
    }

So when ever items are updated clustering is recreated.

Describe the solution you'd like I think we should be able to provide some diffing to only add or remove a subset of items.

Describe alternatives you've considered I also though about just coping whole Clustering method and add custom logic, but it's not possible to reuse ResetMapListeners method.

MikolajKakol avatar Jan 09 '24 11:01 MikolajKakol

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@MikolajKakol Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Jan 09 '24 11:01 wangela

Absolutely agree! 👍 This would be a valuable addition. Let's prioritize this!

PabloJuice avatar Jan 09 '24 12:01 PabloJuice

Hi @MikolajKakol ,

Did you check the sample using the NonHierarchicalViewBasedAlgorithm? This only renders the screen content.

kikoso avatar Jan 09 '24 12:01 kikoso

Hi @kikoso, it would be possible solution if I could populate map with all points from backend, but it is not possible to fetch all of them.

MikolajKakol avatar Jan 09 '24 12:01 MikolajKakol