googlemaps / googlemaps/js-markerclusterer

MarkerClusterer with SuperClusterAlgorithm appears to de-duplicate markers with identical coordinates

Open
#1,024 1 comment 1 reaction 0 assignees View on GitHub
triage me type: bug
Dominant language
TypeScript
Stars
293
Forks
104
Avg merge
3m
Merged PRs (30d)
18

Description

Environment details
API: Maps JavaScript API - @googlemaps/markerclusterer

OS: macOS (Apple M3)

Library version: @googlemaps/markerclusterer (2.0.15) with google.maps.marker.AdvancedMarkerElement.

Summary
When using MarkerClusterer with SuperClusterAlgorithm, it appears that multiple AdvancedMarkerElement instances that share the exact same coordinates are being treated as a single point. The resulting cluster icon shows a count of "1" instead of the total number of markers passed for that location.

This behavior is unexpected, as the library should cluster all provided markers. In our application, we have a side panel that lists the total number of entities (which is correct), but the map's visual cluster count is incorrect due to this apparent de-duplication, leading to a confusing user experience.

Steps to reproduce
Initialize a Google Map.

Create an array of multiple google.maps.marker.AdvancedMarkerElement instances, ensuring at least two or more share the exact same latitude and longitude.

Initialize MarkerClusterer using the default SuperClusterAlgorithm.

Call markerClusterer.addMarkers() with the array of markers.

Observe the map. A cluster will form at the specified coordinate, but its count will be "1" instead of the actual number of markers at that location.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.