Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

point clustering #320

Closed
incanus opened this issue Jun 11, 2014 · 62 comments · Fixed by #5724
Closed

point clustering #320

incanus opened this issue Jun 11, 2014 · 62 comments · Fixed by #5724
Labels
Android Mapbox Maps SDK for Android feature iOS Mapbox Maps SDK for iOS

Comments

@incanus
Copy link
Contributor

incanus commented Jun 11, 2014

Once we have #170 GeoJSON with arbitrary points complete, then we need to be able to cluster overlay points for parity with existing mobile APIs.

@jonathanduty
Copy link

Any status on Marker clustering in iOS?

@mitchellporter
Copy link

I'm interested in annotation clustering on iOS as well 👍 .

Any idea when something like this will be released?

@incanus
Copy link
Contributor Author

incanus commented Oct 27, 2015

Nothing on the radar right now for clustering, but stay tuned for annotations improvements in the medium-term. In short, we are thinking more about potential aspects of annotations that are unique to Mapbox GL and not necessarily derivative of what's been done with maps frameworks before.

@rsimenok
Copy link

Clustering it's very important feature as for me. I hope it will be added soon.

@rsimenok
Copy link

Dear Developers, i need you advice :)
Clustering it's critical task in my current project, so what should i do, use old SDK because it has clustering or wait for clustering in prerelease versions? Main problem is that i can't wait more than two-three weeks. Thank you.

@incanus
Copy link
Contributor Author

incanus commented Nov 19, 2015

Clustering is not on a current timeline for 2015. Stuff needs to happen under the hood in what we’re calling the runtime style API first (see #837). /cc @jfirebaugh

@rsimenok
Copy link

@incanus Okay, can i use old SDK version and buy standard or premium plan?

@pdgoodman
Copy link

@Sh1mor1nka - happy to figure out which plan is correct for you while you're waiting for clustering via the GL SDKs. Want to shoot a note to [email protected] with this ticket number included for reference?

@rsimenok
Copy link

@pdgoodman i don't have much time, may be two weeks, maybe thee, but not more, and as your developer says: "Clustering is not on a current timeline for 2015". All i can is to use old SDK, but i don't know if i can do tbis, maybe it's not supported by current API version, so i'm waiting for developer answer.

@incanus
Copy link
Contributor Author

incanus commented Nov 19, 2015

Clustering is done client-side and is indeed still active in the iOS SDK 1.x (which is not based on Mapbox GL or OpenGL). So you should be fine to go there. You’ll want to look at the clustering-related properties on RMMapView.

@rsimenok
Copy link

@incanus Sorry, but can you share reference where i can download latest SDK 1.x version?

UPD: Okay, i find it https://github.com/mapbox/mapbox-ios-sdk-legacy
But what pricing plans i can use with this SDK?

@incanus
Copy link
Contributor Author

incanus commented Nov 19, 2015

👉 https://github.com/mapbox/mapbox-ios-sdk-legacy

It's also available in CocoaPods as Mapbox-iOS-SDK up to version 1.6.1.

@bleege bleege added iOS Mapbox Maps SDK for iOS Android Mapbox Maps SDK for Android labels Nov 30, 2015
@gilazr
Copy link

gilazr commented Jan 8, 2016

Hi guys. Is there an expected solution to the whole no-clustering issue on iOS?

@Avarga954
Copy link

I would also love to see clustering on ios/android sdk

@maqen
Copy link

maqen commented Jan 28, 2016

Now that JS SDK has gotten clustering support #1931 what needs to happen to get similar on this?

@mourner
Copy link
Member

mourner commented Jan 28, 2016

I'd expect this to come in a few weeks. I'm working on porting https://github.com/mapbox/supercluster, which is relatively small, to C++11. Integration into gl-native then should be pretty easy.

@maqen
Copy link

maqen commented Jan 29, 2016

Sounds great @mourner!

I've gone ahead an tried implementing clustering using quad tree using FBAnnotationClustering converting it to support mapbox instead.

But I get stuck on how to get zoom scale and width of visible view from mapbox similar to this

double scale = self.mapView.bounds.size.width / self.mapView.visibleMapRect.size.width;

and converting this to support mapbox constants

NSInteger FBZoomScaleToZoomLevel(MKZoomScale scale)
{
    double totalTilesAtMaxZoom = MKMapSizeWorld.width / 256.0;
    NSInteger zoomLevelAtMaxZoom = log2(totalTilesAtMaxZoom);
    NSInteger zoomLevel = MAX(0, zoomLevelAtMaxZoom + floor(log2f(scale) + 0.5));

    return zoomLevel;
}

But implementing clustering using r tree is the way to go, have you any ideas where I can find a r tree library for objective-c? Can then look into converting supercluster to objective-c.

@maqen
Copy link

maqen commented Jan 29, 2016

Maybe start porting your wonderful rbush is a good start.

@mourner
Copy link
Member

mourner commented Jan 29, 2016

@maqen I don't know since I focus on JS development, but the coming implementation in gl-native will most likely use boost:rtree. We're still eager to try porting rbush someday and seeing how it compares.

In addition, I'm doing some experiments on a different index instead of an R-tree, optimized for clustering and based on lexicographic array sorting in a grid + binary search. But it may take a while before I get results, although I'm certain it will be faster than R-Tree.

@benjisora
Copy link

any updates on the implementation of clustering ?

@Maxwell-Thom
Copy link

@mourner Hows it going my friend? any news for us hopefuls?

@mourner
Copy link
Member

mourner commented Jun 23, 2016

The work is still going. Related prerequisite issues to track are:

@ghost
Copy link

ghost commented Jul 8, 2016

Hey, please let us know even if it reaches the testing phase, I would like to test and help improve it as early as possible. So badly in need of clustering.
Thank you :)

@mourner mourner mentioned this issue Jul 19, 2016
11 tasks
@shfishburn
Copy link

Is this feature release close?

@incanus
Copy link
Contributor Author

incanus commented Jul 27, 2016

Noting here that discussions of clustering will have to separately consider annotation view structure as well on each platform, if we are also going to allow clustering there.

@mourner
Copy link
Member

mourner commented Jul 27, 2016

#5724 was just merged to master. Which means you will now be able to add clustered GeoJSON sources and style them like on the GL JS example here.

@1ec5
Copy link
Contributor

1ec5 commented Jul 28, 2016

To expand on @mourner’s much welcome update:

@ttoni
Copy link

ttoni commented Jul 28, 2016

What about mapboxgl-js HTML markers and clustering?

Am 28.07.2016 um 06:43 schrieb Minh Nguyễn [email protected]:

To expand on @mourner https://github.com/mourner’s much welcome update:

#5724 #5724 implements clustering for points in GeoJSON layers. If you’re unfamiliar with that terminology, that’s because historically GeoJSON layers have been immutable elements baked into the style and not accessible via the SDKs. In #5642 #5642 and #5642 #5642, we implemented a runtime styling API on Qt and Android, respectively, allowing you to manipulate and style GeoJSON layers on the fly. The same feature is coming to the iOS and macOS SDKs: #5626 #5626 #5727 #5727.
Most of the requests we’ve received for marker clustering have understandably been in relation to point annotations (known on Android as markers) rather than GeoJSON points. #5814 #5814 tracks adding APIs to cluster point annotations just as you can now cluster GeoJSON points.
The final step will be to extend point annotation clustering to view-backed annotations: #5815 #5815.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #320 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ABQVtWg-BsHdteaSrPXN-hQugmkzUGVTks5qaDN3gaJpZM4CDZzA.

@1ec5
Copy link
Contributor

1ec5 commented Jul 28, 2016

That's a good question. However, since this is the Mapbox GL Native repository, please request that feature in the GL JS repository. Thanks!

@2ndGAB
Copy link

2ndGAB commented Aug 12, 2016

Just to give my 2 cents as I just switched my tile provider to Mapbox. But I'm still using osmdroid/osmbonuspack, mainly for markers clustering which is well implemented in it.

For me, key features are:

  • support of customized marker icon and customized cluster icon.
  • defining the minimum number of markers to cluster because clustering is not hidding markers; Without this, we will need to zoom in up to the highest level to explode just 2 close markers. default value of 5 is a good choice as GoogleMap API do.
  • overriding clusterization method because sometimes it's very cool to cluster all markers but one or two very important markers we don't want to cluster.

@o15a3d4l11s2
Copy link

Any updates on clustering markers (annotations) using the SDKs?

@1ec5
Copy link
Contributor

1ec5 commented Oct 16, 2016

Any updates on clustering markers (annotations) using the SDKs?

@o15a3d4l11s2, please subscribe to #5814. That issue will be updated as soon as there’s progress to report.

In the meantime, consider reimplementing your markers as a GeoJSON source styled with a symbol layer. GeoJSON sources can already be clustered, although you’ll have to implement interactivity manually. You may also want to keep track of #6181 and its dependent issues, which would hopefully eliminate that caveat.

@1ec5
Copy link
Contributor

1ec5 commented Oct 16, 2016

support of customized marker icon and customized cluster icon

@2ndGAB, this should already be possible with the runtime styling API; see #320 (comment). We don’t have a live native example online yet, but refer to this GL JS example for now. Now how the cluster-count layer can apply any symbol layer property.

defining the minimum number of markers to cluster because clustering is not hidding markers; Without this, we will need to zoom in up to the highest level to explode just 2 close markers. default value of 5 is a good choice as GoogleMap API do.

If this isn’t already supported for GeoJSON sources, please file a separate issue. The implementation may require some changes upstream in Supercluster.hpp and/or Supercluster.

overriding clusterization method because sometimes it's very cool to cluster all markers but one or two very important markers we don't want to cluster.

Similarly, this would be a great enhancement to request in a separate issue. Additional comments on this closed issue are less likely to be read by the project’s developers, and therefore less likely to be prioritized.

@Preen
Copy link

Preen commented Feb 16, 2017

Any status on this?

@ttoni
Copy link

ttoni commented Feb 22, 2017

Is this a low priority feature? Seems to me that everyone putting more than 20 markers on a map needs this.

@cupofjoakim
Copy link

To us it's a must have, and I'm surprised that anyone would consider this low priority. I guess there's other maplibs out there, but mapbox is usually soo good!

@AAverin
Copy link

AAverin commented Feb 22, 2017

This missing is the only reason why I still keep using Google Maps for my app

@ttoni
Copy link

ttoni commented Feb 22, 2017

@AAverin same here

@vegidio
Copy link

vegidio commented Feb 22, 2017

I subscribed to this thread 2 years ago when I was considering to use Mapbox in my projects... After so much time I'm happy that I didn't waste my time with this SDK and I decided to use Google Maps. It's pathetic how something so important like this is still not implemented.

@Preen
Copy link

Preen commented Feb 22, 2017

We decided to go with another map solution instead. Sad.

@incanus
Copy link
Contributor Author

incanus commented Feb 22, 2017

To clarify, recent comments are asking about view-backed annotation clustering? Because per #320 (comment) we have had GL-backed clustering for some time now (API). I'll look into adding an example of the latter to our gallery.

@incanus
Copy link
Contributor Author

incanus commented Feb 22, 2017

Re: addressing the core need of marker-backed clustering, the main holdup is #6181 and all of its associated dependency work. This would move the MapKit-like annotation model to be a thin implementation layer on top of Mapbox's unique GL-based runtime styling functionality (which you can't get in other toolkits). Per @1ec5 in that ticket:

Developers should be able to think of the annotation API as nothing more than a shortcut for runtime styling functionality, rather than an entirely separate code path.

We originally implemented annotations for parity with Apple and Google tools and because it's what people would expect, but where we've taken runtime styling and our open styling spec brings capabilities far beyond these. Developers no longer have to think about maps as just your own data on top of an opaque map, but rather can mix your data into the map in a much more immersive way.

As a result of this a) early annotation parity for familiarity and b) the substantial backlog of things we need to do to bring the two APIs together, this has been taking a while.

@mapbox mapbox locked and limited conversation to collaborators Feb 22, 2017
@boundsj
Copy link
Contributor

boundsj commented Feb 22, 2017

Our examples repo will be updated soon with a comprehensive runtime styling example that shows how to cluster and visualize GeoJSON data (GL-backed clustering). In the meantime, here is a gist that ports the GL JS heatmap example that uses clustering to iOS.

@1ec5
Copy link
Contributor

1ec5 commented Feb 22, 2017

To reiterate, anyone interested in clustering annotations (as opposed to GeoJSON sources aka shape sources) should subscribe to #5814 and #5815.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android feature iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.