alfonsocejudo / fluster

A geospatial point clustering library for Dart.
MIT License
68 stars 25 forks source link

Get any kind of data about children of cluster #10

Open TheLastGimbus opened 3 years ago

TheLastGimbus commented 3 years ago

Hi there!

I'm making an app where we use flutter_map - on this map, we will have ~4k markers. Because of this, it lags very much, and we really need to cluster thse for our app to be usable

For past 4 weeks I've been trying to do this well, and all libraries are failing miserably at some point

Your library is so far the best perfomant, and I can get 60 fps :100: when re-drawing it and generally messing with the markers

But it fails in one aspect - I can't get the data about children markers (efficiently)

All markers in our app represent some int value - and I would like clusters to represent averge of those ints - problem is that:

Fluster(
  ...
  createCluster: (BaseCluster cluster, lng, lat) {
    // There is no way to get data about children ("non-cluster objects") from BaseCluster
  }
)

I tried to get this from outside Fluster constructor, with fluster.points() - but it turns out it does some heavy calculations under the hood, and re-running it 500 times make everything super laggy

At this point, @alfonsocejudo, I deperatly need your help or I will freak out :pray: - if you could add any way for BaseCluster to contain some data about it's children, or show me how I could add this in a fork - I could finally finish my job, which I initially thought would take me 2 hours :vomiting_face:

2RocksStudio commented 3 years ago

hi @TheLastGimbus , i got the same 4k+markers in the map.
when i try to update the markers when onCameraMove , will clear all and add again. But it is very lag when the zoom level is big (15 or lower). May i know how you handle the 4k+ markers update when zoom level change? Btw Sorry for asking question that not relay to this issue. Hope you may help me, thanks

TheLastGimbus commented 3 years ago

Hi there! I started making my own library that draws markers directly with canvas instead of widgets, and it performs pretty nice!

You can take a look here, at dev branch: https://github.com/KanarekApp/flutter_map_fast_markers/tree/dev

Altough I will try to optimise it even more, and it uses our flutter_map fork too... but you can watch it for any releases, because they will come sooner or later :100:

Lzyct commented 2 years ago

Any update about this issue ? I need to get all children id inside cluster

Thanks