googlemaps / googlemaps/js-markerclusterer
[Markers] Using AdvancedMarkerElement with a `lat` or `lng` of 0 results in it not being drawn.
- Dominant language
- TypeScript
- Stars
- 293
- Forks
- 104
- Avg merge
- 3m
- Merged PRs (30d)
- 18
Description
#### Steps to reproduce
1. Create a map, clusterer and an AdvancedMarkerElement
2. Set the marker's latitude, longitude or both to be 0
3. Pass marker to clusterer
#### Code example
```typescript
const marker = new google.maps.marker.AdvancedMarkerElement({
position: { lat: 0, lng: 1 },
title: 'Hi',
});
markers.push(marker);
});
new MarkerClusterer({
markers,
map: this.map,
renderer: new ClusterRenderer(),
});
```
Nothing on my map :(
I'm pretty sure this condition from the `MarkerUtils` is the culprit
```typescript
if (marker.position.lat && marker.position.lng) {
return new google.maps.LatLng(
marker.position.lat,
marker.position.lng
);
}
```
and might be fixed by instead doing
```typescript
if ('lat' in marker.position && 'lng' in marker.position) {
return new google.maps.LatLng(
marker.position.lat,
marker.position.lng
);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.