Reputation: 197
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?
Upvotes: 3
Views: 912
Reputation: 34037
This is the documentation about Huawei Map Kit Clustering Markers. You can also refer to sample code provided by @deadfish.
I’d like to add a useful tool, which is based on Google's open-source tool and adapts to the Huawei Map cluster manager. You are advised to integrate the tool to cluster markers.
Usage:
allprojects {
repositories {
...
flatDir {
dirs 'libs'
}
}
}
dependencies {
implementation(name: '3rd-maps-utils-2.1.0-yyyyMMdd', ext: 'aar')
...
}
UPDATE
Upvotes: 1
Reputation: 3362
You could check out my ClusterManager with example on Huawei Map.
https://github.com/hunterxxx/huawei-map-clustering
Upvotes: 2
Reputation: 12304
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);
}
Upvotes: 3