alfonsocejudo / fluster Goto Github PK
View Code? Open in Web Editor NEWA geospatial point clustering library for Dart.
License: MIT License
A geospatial point clustering library for Dart.
License: MIT License
Is there any option to show the cluster icon without any customization?. I want to show round shape cluster icon without any customization markers that looks in top of our blog page. is there any please suggest me. I want the implemented the feature for my map.
Thanks
I have a list of LatLng values initially while creating the clusterManager.
I want to add more LatLng values dynamically.
Currently I reinitialize the cluster manager with a new list of LatLng. So is this the correct way or is there something out of box available.
final List<LatLng> _markerLocations = [
LatLng(41.147125, -8.611249),
LatLng(41.145599, -8.610691),
LatLng(41.145645, -8.614761),
LatLng(41.146775, -8.614913),
LatLng(41.138344, -8.611236),
LatLng(41.139813, -8.609381),
];
/// Inits [Fluster] and all the markers with network images and updates the loading state.
void _initMarkers() async {
final List<MapMarker> markers = [];
for (LatLng markerLocation in _markerLocations) {
final BitmapDescriptor markerImage =
await MapHelper.getMarkerImageFromUrl(_markerImageUrl);
markers.add(
MapMarker(
id: _markerLocations.indexOf(markerLocation).toString(),
position: markerLocation,
icon: markerImage,
),
);
}
_clusterManager = await MapHelper.initClusterManager(
markers,
_minClusterZoom,
_maxClusterZoom,
);
await _updateMarkers();
}
Once the above code is run I want to add more locations to the cluster
markerLocations.addAll([
LatLng(41.146982, -8.615682),
LatLng(41.140558, -8.611530),
LatLng(41.138393, -8.608642),
LatLng(41.137860, -8.609211),
]);
Now Do I have to reinitialize the clusterManager to reflect this change ? setState does not do any good.
This might be related to #20
Hi there!
I'm using supercluster to cluster points in realtime on my client (generating cluster only at the zoom level I currently am) but I noticed something weird.
When the viewport change, I re fetch my points and re run the clustering on them, the resulting clusters are arranged differently (as shown below) than before even tho the points and zoom level is the same.
Is this normal behavior?
Cheers!
I want to set bound based on available markers but when i am setting cameraTargetBounds using southwest & northeast positions it is not working. Could you please suggest is this the correct way to achieve the same.
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 💯 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 int
s - 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 🙏 - 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 🤮
I have an error using the null safety version
E/flutter ( 687): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: type '(BaseCluster, double, double) => MapMarker' is not a subtype of type '((BaseCluster?, double?, double?) => MapMarker)?'
I initialised the cluster in this way:
minZoom: minZoom,
maxZoom: maxZoom,
radius: 150,
extent: 4096,
nodeSize: 64,
points: markers,
createCluster: (
BaseCluster cluster,
double lng,
double lat,
) =>
MapMarker(
id: cluster.id.toString(),
latitude: lat,
longitude: lng,
isCluster: cluster.isCluster,
clusterId: cluster.id,
pointsSize: cluster.pointsSize,
childMarkerId: cluster.childMarkerId,
),
);
Do you know what the problem is?
Originally posted by @PaoloP98 in #12 (comment)
I delete a marker from set by
Marker marker = markers.firstWhere((marker) => marker.markerId.value == prd.id);
setState(() {
markers.remove(marker);
});
But it look like not deleted from cluster because the deleted marker shows again after await _updateMarkers();
. Any suggestion?
I was wondering if there is a way in which i can get all the cluster names/ids of the markers that make up a cluster.
Thanks for any suggestions or help?
First of all good work with the lib and providing an alternative for clustering.
I've followed your example with a bloc provider and tried to adapt it to my use case.
One major difference is that in my scenario I have over 700 items that need to be displayed on the map (a perfect case for clustering :)).
The data is passed from an http service and filtered based on some conditions that can change outside the map. That's why I use a provider to reload the map when data changes (the data can change based on the filtering).
My markers have different marker icons depending on the item type, the cluster icon has a number - children count that are under the parent. For this reason, I needed to make the function that creates markers an async function (because of the drawing of cluster icons to be exact).
I observed that with this amount of items my app has performance issues (it recalculates the cluster markers on each zoom or camera position change). Because I'm using async functions, this adds extra overlap to the overall process.
There is the demo:
https://drive.google.com/open?id=19USypvWS0KIRF7J1-42mSHVYV9BfoMkr
Hi! I have implemented fluster with custom Markers, i've followed this tutorial:
https://coletiv.com/blog/how-to-cluster-markers-on-google-maps-using-flutter/
I don't know how to create a custom popup when marker is tapped.
And I want to create a custom action when cluster is tapped. Can you help me please?
If you could provide a real-world example with flutter and the google maps plugin, it would be great.
Is there a way in which to use fluster with mapbox flutter
https://pub.dev/packages/mapbox_gl#-readme-tab-
Is there any option to show the cluster icon without any customization?. I want to show round shape cluster icon without any customization markers that looks in top of our blog page. is there any please suggest me. I want the implemented the feature for my map.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.