[MOD-2426] Ti.Map: Android - Marker Clustering
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-05-29T15:28:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.4.0 |
Components | Map |
Labels | android, clustering, feature, maps, mapview, ti.map |
Reporter | Ralf Pfeiffer |
Assignee | Hans Knöchel |
Created | 2011-04-15T03:30:17.000+0000 |
Updated | 2018-08-06T17:57:53.000+0000 |
Description
Ti needs a way to easily cluster markers within the native MapView used in [Ti.Map](https://github.com/appcelerator-modules/ti.map).Comments
- Zarir Bhesania 2015-10-30 This is a commonly used feature in Map. Please include it for iOS and Android
- Sebastian Klaus 2016-01-06 +1
- Hans Knöchel 2016-01-30 There is an experimental support for iOS clustering using Google Maps available [here](https://github.com/hansemannn/Ti.GoogleMaps/tree/clustering). For Ti.Map: - iOS: As far as I know, MapKit (which is used by ti.map iOS) does not have an API for clustering, there are only 3rd-party solutions / algorithms available. - Android: There is an [API](https://developers.google.com/maps/documentation/android-api/utility/marker-clustering?hl=en) by Google Maps (which is used by ti.map Android) that could be implemented. If someone from the community is interesting in contributing this functionality, feel free to create a pull request!
- Hans Knöchel 2016-02-08
Update on this feature: I just implemented a proof of concept of iOS MKMapKit annotation clustering. It uses the native FBAnnotationClustering library to group the annotations. The result can be found here: https://github.com/hansemannn/ti.map/tree/Clustering. Note: This feature is still very experimental, I tested it using 10000 annotations using this demo:
We may can consider to bring this into the master branch some time, but not without the Android equivalent.var map = require("ti.map"); var mapView = map.createView({ clusterCellSizeFactor: 0.5, clusterTintColor: "red" clusterTextColor: "white" }); var annotations = []; for(var i = 0; i < 10000;i++) { annotations.push(map.createAnnotation({ latitude: 52.695348 +i, longitude: 7.299401 + Math.sin(i), title: "Annotation" })); } mapView.setAnnotations(annotations); mapView.cluster(); var window = Ti.UI.createWindow(); window.add(mapView); window.open();
- Hans Knöchel 2016-02-08 Added some more functionality and docs, so everyone who already needs the functionality can grab it from this PR: https://github.com/appcelerator-modules/ti.map/pull/149
- Sebastian Klaus 2016-02-09 I tried your cluster branch, but on mapView.cluster(), all pins are gone and no cluster marker appear.
- Hans Knöchel 2016-02-09 Interesting, can you provide a demo to reproduce? Also, are you using custom pins and/or overlays? Early tests have only been done with "native" pins.
- Hans Knöchel 2017-04-18 Side note: Stable clustering is also available in [Ti.GoogleMaps](https://github.com/hansemannn/ti.googlemaps/) for the ones interested!
- Hans Knöchel 2017-06-06 iOS 11 finally supports native clustering! This could be considered for Ti.Map on both iOS and Android by now.
- Michael Gangolf 2017-09-17
Started a fork for Ti.Map Android at https://github.com/m1ga/ti.map/tree/cluster
The click-events are not working (infobox) but the clustering is handled by
android-maps-utils-release.aar
- Hans Knöchel 2017-10-12 The iOS-part is now merged and part of Ti.Map iOS 3.0.0. Android will likely follow once the review-comments are cleared.
- Hans Knöchel 2018-05-25 PR (community, thanks to [~michael]): https://github.com/appcelerator-modules/ti.map/pull/215
- Hans Knöchel 2018-05-29 All PR's merged. New release available: https://github.com/appcelerator-modules/ti.map/releases/tag/android-4.3.0
- Eric Merriman 2018-08-06 Cleaning up older fixed tickets from 2016 and earlier. If this ticket should not have been closed, please reopen it.