android-studiogoogle-mapshuawei-mobile-servicescluster-manager

What is the equivalent of the cluster manager feature used in Google map on Huawei Map?


I am trying to implement Huawei Map Kit to my android project. As you know google provides cluster manager to group many items on a map based on zoom level. How can I implement same feature in Huawei Map?


Solution

  • Take a look at the example. Is that what you are looking for?

     @Override
     public void onMapReady(HuaweiMap map) {
         mMap = map;
    
         // Set zoom
         mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(48.864716, 2.349014), 10));
    
         // Add markers clusterable
         mMap.addMarker(new MarkerOptions().position(new LatLng(48.861716, 2.349014)).title("Marker1").clusterable(true));
         mMap.addMarker(new MarkerOptions().position(new LatLng(48.862716, 2.349014)).title("Marker2").clusterable(true));
         mMap.addMarker(new MarkerOptions().position(new LatLng(48.863716, 2.349014)).title("Marker3").clusterable(true));
         mMap.addMarker(new MarkerOptions().position(new LatLng(48.864716, 2.349014)).title("Marker4").clusterable(true));
         mMap.addMarker(new MarkerOptions().position(new LatLng(48.865716, 2.349014)).title("Marker5").clusterable(true));
         mMap.addMarker(new MarkerOptions().position(new LatLng(48.866716, 2.349014)).title("Marker6").clusterable(true));
    
         // Set markers clusterable
         mMap.setMarkersClustering(true);
     }