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?
Asked
Active
Viewed 771 times
3
-
You can cluster markers but afaik currently Huawei Maps SDK does not support ClusterManager API yet. ā m0skit0 Jun 09 '20 at 10:36
3 Answers
3
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);
}

deadfish
- 11,996
- 12
- 87
- 136
1
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:
- Open Gradle, click library->Tasks->build->assemble.
- After Run, find 3rd-maps-utils-2.1.0-yyyyMMdd.aar file from Github in library/build/outputs/aar/ path.
- Copy 3rd-maps-utils-2.1.0-yyyyMMdd.aar file to your own app/libs/ path.
- Add codes below in project build.gradle file.
allprojects {
repositories {
...
flatDir {
dirs 'libs'
}
}
}
- Add codes below in app build.gradle file.
dependencies {
implementation(name: '3rd-maps-utils-2.1.0-yyyyMMdd', ext: 'aar')
...
}
UPDATE

zhangxaochen
- 32,744
- 15
- 77
- 108
-
Hi. I am currently trying to implement it but do not know-how. I could not find "library" in a Gradle window to run assemble and extract that dependency. Also how we really use it? Is there Google's ClusterManager which we can use with HuaweiMap or what? Please, it is really important for me if you can explain I'd really be thankful. ā Aytaj Jan 22 '21 at 08:08
-
I have update the screenshoot where you can find the assemble in the upper right corner of AS by clicking "Gradle" :) ā zhangxaochen Jan 22 '21 at 09:25