mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

Android Point Clustering Implementation #4693

Closed bleege closed 8 years ago

bleege commented 8 years ago

Point Clustering in the native SDKs is going to make use of @mourner's Supercluster work from GL JS. The Supercluster library will be first ported to Core GL in C++ and then the Android bindings will be written on top to expose it for use in the Mapbox Android API. An example activity will also be created in the Android TestApp for development and general demonstration purposes.

@mapbox/mobile @twbell

tobrun commented 8 years ago

Linking #320

shfishburn commented 8 years ago

When is this going to be implemented for the iOS SDK and released?

twbell commented 8 years ago

@shfishburn working on timing now; forthcoming.

1ec5 commented 8 years ago

@shfishburn, we’re planning to tackle this on both platforms roughly in tandem. Both SDKs are blocked on support at the core, cross-platform level, however. We’re tracking that work in #320.

shfishburn commented 8 years ago

Assuming the architect of an iOS or Android client implements a lazy loading pattern for POIs to be displayed in a list or map view, then the need to cluster markers at the scope of (say) North America is a bit of overkill (IMHO). Don't think a bit circle with a massive integer is necessary over the United States to inform a user "there be dragons here." That's not a great user experience. I understand doing this work in the core and in tandem, but "forthcoming" and "soon" are variables that contribute to difficult decision on allocating resources and just doing something outside the MapBox SDK.

1ec5 commented 8 years ago

This is a little off-topic for this issue, but lazily loading annotations is somewhat orthogonal to clustering. The Android and iOS SDKs already allow you to add and remove annotations/markers relatively efficiently. #4694 would make it easier for you to know when to add or remove an annotation. Or is https://github.com/mapbox/mapbox-gl-native/issues/320#issuecomment-197049642 still representative of what you’re hoping to accomplish? As demonstrated in this blog post, Supercluster can also be useful for heat map–style visualizations in addition to traditional, numbered clustering.

shfishburn commented 8 years ago

Lazy loading is appropriate even with clustering in very high density, ubran areas. Think of Manhattan where it takes almost a street level zoom on the map to de-cluster and present discrete markers that represent the POIs. Smart, lazy loading based on certain conditions along with clustering is generally our approach because of density. Yes, #320 is what we're trying to accomplish.

By the by numbered clustering is not our fave. We've implemented something in a prior version of our platform called dots and markers. It works well but the port from Google Maps to Mapbox is quite an effort. Perhaps we should get started :)

subashsn commented 8 years ago

Please add this feature soon! Faced too many issues with legacy sdk, so using googleMaps for now :/

AAverin commented 8 years ago

Just started developing a new app and was surprised to find out that clusters are not yet supported. Will be definitively waiting for this feature to appear.

abhinav-adtechs commented 8 years ago

Waiting desperately for this feature to be added ASAP! Please give an ETA.

shfishburn commented 8 years ago

Mapbox has gone dark on a date.

On Mon, May 16, 2016 at 11:34 AM, Abhinav Das notifications@github.com wrote:

Waiting desperately for this feature to be added ASAP! Please give an ETA.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/mapbox/mapbox-gl-native/issues/4693#issuecomment-219507057

twbell commented 8 years ago

@shfishburn, @abhinav-adtechs, @AAverin:

@bleege's notes in his OP are still valid. In absolute terms we are working on the Core GL work for this feature now, and you'll see the capability expose in the Next +1 Release: iOS 3.4/Android 4.2. We are targeting Q3 for this feature, so somewhere in the July/August timeframe.

A broader note on timing and release dates: we do not post a Release Date until we can be fairly confident of hitting it; this usually means that the release is fully scoped and the necessary research is completed. We've all been on the receiving end of delayed releases, so we're trying to avoid being overly optimistic. I appreciate that the other end of the spectrum is opacity, which is equally unhelpful, so I'll work more to give what guidance we can as soon as we can give it.

2ndGAB commented 8 years ago

Hello, Just to give my 2 cents because I'm using clustering on Android and I'm very interesting to get it on iOS, clustering goal is not to hide markers/annotations but to reduce their number in high annotations density areas.

I mean, as Google Map API does, it's necessary to define a minimal number of annotations to cluster (by default 5 for example) to prevent to have to deeply zoom an area to see just 2 annotations close together.

And I hope that as we do on Android, we will be able to customize annotation icon and cluster icon.

zugaldia commented 8 years ago

Support for clustering via a GeoJson source has been brought to Android in https://github.com/mapbox/mapbox-gl-native/issues/5852. The equivalent iOS approach (via a MGLGeoJSONSource) was done in https://github.com/mapbox/mapbox-gl-native/issues/5962.

We've also published a sample CreateHeatmapPointsActivity that shows how to use this new API:

ezgif com-video-to-gif 3

Closing this now as all tasks listed in OP have been completed.

1ec5 commented 8 years ago

If you need interactivity with clustered GeoJSON points, you’ll need to install your own click handler that queries for nearby rendered features and displays their information in the UI. The SDK does all this for you if you use a Marker; #5814 and #5815 tracks implementing clustering for Marker too.

vikoo commented 6 years ago

@1ec5 How to get the geo points from cluster click? Do you have any example for this?

1ec5 commented 6 years ago

@vikoo, the Android demo repository would be the place to look for examples. mapbox/mapbox-android-demo#560 might be of interest to you.