mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

point clustering

Open incanus opened this issue 12 years ago • 62 comments

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.

incanus avatar Jun 11 '14 20:06 incanus

Any status on Marker clustering in iOS?

jonathanduty avatar Oct 24 '15 15:10 jonathanduty

I'm interested in annotation clustering on iOS as well :+1: .

Any idea when something like this will be released?

mitchellporter avatar Oct 26 '15 22:10 mitchellporter

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.

incanus avatar Oct 27 '15 00:10 incanus

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

rsimenok avatar Nov 14 '15 11:11 rsimenok

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.

rsimenok avatar Nov 19 '15 12:11 rsimenok

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

incanus avatar Nov 19 '15 18:11 incanus

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

rsimenok avatar Nov 19 '15 18:11 rsimenok

@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?

pdgoodman avatar Nov 19 '15 20:11 pdgoodman

@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.

rsimenok avatar Nov 19 '15 20:11 rsimenok

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.

incanus avatar Nov 19 '15 22:11 incanus

@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?

rsimenok avatar Nov 19 '15 23:11 rsimenok

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

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

incanus avatar Nov 19 '15 23:11 incanus

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

gilazr avatar Jan 08 '16 14:01 gilazr

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

Avarga954 avatar Jan 12 '16 06:01 Avarga954

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

maqen avatar Jan 28 '16 11:01 maqen

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.

mourner avatar Jan 28 '16 13:01 mourner

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 avatar Jan 29 '16 10:01 maqen

Maybe start porting your wonderful rbush is a good start.

maqen avatar Jan 29 '16 10:01 maqen

@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.

mourner avatar Jan 29 '16 10:01 mourner

We manage about 22m POIs in the US with very, very high density urban areas. The clustering feature is supported in the 1.x SDK but not yet in 3.x. Options seem to be:

A. Use a deprecated SDK. B. Use a web view in iOS with Leaflet (for example) C. Live without it. D. Port or write a bunch of custom code. E. Revert to using Google Maps

None of these are good options. Am I missing something?

shfishburn avatar Mar 15 '16 21:03 shfishburn