mrmans0n / clusterer Goto Github PK
View Code? Open in Web Editor NEWClustering in Maps v2 for Android
Clustering in Maps v2 for Android
Hello,
i m using your library in my project and when the camera of my cluster change position, i made an update of data and i draw again my cluster but sometimes the cluster gone with no reason
My app displays a map, and it dynamically loads the POIs as the user browses/scrolls the map.
Then if it checks if the POIs in the result list are already in the map or not. If not, add them to the map:
// Class vars
private ArrayList<MyPoi> markerList;
private Clusterer<MyPoi> clusterer;
// ...
clusterer = new Clusterer<MyPoi>(this, googleMap);
clusterer.setOnCameraChangeListener(new Clusterer.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition cameraPosition) {
// Async call API to get POI
call(new Handler<List<MyPoi>>() {
@Override
public void handle(List<MyPoi> result) {
// Run this when call is done
// For each POI in the POI list
for (MyPoi poi : result) {
// Check if POI is not in the map already
boolean newMarker = true;
for (Clusterable marker : markerList) {
if (marker.getPosition().equals(poi.getPosition())) {
newMarker = false;
break;
}
}
// Add POI to map if new
if (newMarker) {
markerList.add(poi);
clusterer.add(poi); // Crash here!
}
}
}
});
}
});
However, the app crashes when I try to add the POI (see the commented line).
This is what the Logcat registers: https://gist.github.com/anonymous/e5c5314ed91d8f52cd9c
The message is truncated at the end, and then the app restarts.
I am using version 1.0.2, tested on a device and Genymotion emulator.
hi, i'm trying to use your library but when i add compile 'io.nlopez.clusterer:library:1.0.5' in my build.gradle file, i got this error:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
In the dependencies i have only this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'io.nlopez.clusterer:library:1.0.5'
}
Have you please have a fix for that error?
Regards
That.
I followed the guide in the readme.md and get a stackoverflow error in the lib when using it:
java.lang.StackOverflowError
at io.nlopez.clusterer.QuadTree.insertData(QuadTree.java:23)
at io.nlopez.clusterer.QuadTree.insertData(QuadTree.java:23)
at io.nlopez.clusterer.QuadTree.insertData(QuadTree.java:23)
at io.nlopez.clusterer.QuadTree.insertData(QuadTree.java:23)
at io.nlopez.clusterer.QuadTree.insertData(QuadTree.java:23)
at io.nlopez.clusterer.QuadTree.insertData(QuadTree.java:23)
For some reason library is clustering markers even on max zoom. It's will be great if you add some threshold param that we can set when initing Clusterer.
I want to handle the click event of preview box which is opened after a tap on Pin.
It would be interesting to have direct Listeners for marker and cluster click.
I'll be doing a PR this weekend on this particular subject.
That too.
It will be more logical if you replace this implementation
public void addAll(List<T> markers) {
this.markers = markers;
}
to this one
public void addAll(List<T> markers) {
this.markers.addAll(markers);
}
Hi, i was able to use your library and create in my android maps application the Cluster, everything works like a charm, thanks.
I trieed then to customize the icon of each markers, using my own icons added in the map, but i have two problems:
1- When zoom in the map and show each marker, behind my own icon appears the default icon of GMaps marker, and i don't know how to hide it in the code (because i haven't added somewhere).
2- When i zoom out the map, and the cluster start to group the markers, my own icons stay visible. (if i don't add my own icons everything works).
Does anyone know how to fix this problems?
More a feature request than a bug really.
When you use https://github.com/googlemaps/android-maps-utils there's a cool animation exploding the cluster onto markers and group markers into clusters.
That would be awesome to have some cool animations like that.
Feature request again.
Adding some number threshold before the markers are clustered would be interesting. "If I have only 2 markers, then don't cluster. Cluster only when I have more than 5" something like that.
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.