Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Markers] Using AdvancedMarkerElement with a lat or lng of 0 results in it not being drawn. #722

Open
GMchris opened this issue Aug 10, 2023 · 1 comment
Labels
good first issue This issue is a good place to started contributing to this repository. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@GMchris
Copy link

GMchris commented Aug 10, 2023

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

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

        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

        if ('lat' in marker.position && 'lng' in marker.position) {
          return new google.maps.LatLng(
            marker.position.lat,
            marker.position.lng
          );
        }
@GMchris GMchris added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 10, 2023
@wangela
Copy link
Member

wangela commented Aug 10, 2023

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@GMchris Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

@usefulthink usefulthink added good first issue This issue is a good place to started contributing to this repository. and removed triage me I really want to be triaged. labels Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is a good place to started contributing to this repository. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants