googlemaps / googlemaps/js-markerclusterer
AdvancedMarker position null messes up cluster location
- Dominant language
- TypeScript
- Stars
- 293
- Forks
- 104
- Avg merge
- 3m
- Merged PRs (30d)
- 18
Description
With the addition of the changes for the AdvancedMarkers, a problem has slipped in.
The documentation of [AdvancedMarkers.position](https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions.position) says:
> An AdvancedMarkerElement may be constructed without a position, but will not be displayed until its position is provided
The problem is that in every algorithm (supercluster/grid/superviewport) the MarkerUtils.getPosition function is used which assumes that position of `null` means `lat=0, lng=0` which then leads to problems when calculating the center of a cluster.
---
One solution could be to return `null` instead of `google.maps.LatLng(null)` in the `MarkerUtils.getPosition` function and then check everywhere where the position is used if `MarkerUtils.getPosition(marker) == null`.
Contributor guide
Assessment
This issue has not been assessed yet.