[MOD-2426] Ti.Map: Android - Marker Clustering

GitHub Issuen/a
TypeNew Feature
Resolution Date2018-05-29T15:28:11.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.4.0
Labelsandroid, clustering, feature, maps, mapview, ti.map
ReporterRalf Pfeiffer
AssigneeHans Knöchel


Ti needs a way to easily cluster markers within the native MapView used in [Ti.Map](https://github.com/appcelerator-modules/ti.map).


  1. Zarir Bhesania 2015-10-30 This is a commonly used feature in Map. Please include it for iOS and Android
  2. Sebastian Klaus 2016-01-06 +1
  3. 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!
  4. 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:
       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++) {
               latitude: 52.695348 +i,
               longitude: 7.299401 + Math.sin(i),
               title: "Annotation"
       var window = Ti.UI.createWindow();
    We may can consider to bring this into the master branch some time, but not without the Android equivalent.
  5. 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
  6. Sebastian Klaus 2016-02-09 I tried your cluster branch, but on mapView.cluster(), all pins are gone and no cluster marker appear.
  7. 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.
  8. 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!
  9. 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.
  10. 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
  11. 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.
  12. Hans Knöchel 2018-05-25 PR (community, thanks to [~michael]): https://github.com/appcelerator-modules/ti.map/pull/215
  13. 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
  14. 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.

JSON Source