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

[Bug] GoogleMapsOverlay does not draw without map interaction #9170

Open
1 of 7 tasks
samschurter opened this issue Sep 20, 2024 · 0 comments
Open
1 of 7 tasks

[Bug] GoogleMapsOverlay does not draw without map interaction #9170

samschurter opened this issue Sep 20, 2024 · 0 comments
Labels

Comments

@samschurter
Copy link

Description

The issue we are running into is that we load the Google map immediately, then later when we have data come in we use that to display a Deck.gl IconLayer. But this new layer doesn't appear unless the user interacts with the map, or we programmatically change some map property.

According to the Google Maps documentation, "The onDraw() method will then be called whenever a map property changes that could change the position of the element, such as zoom, center, or map type."

So as dumb as it sounds, this does seem like the intended behavior on Google's side, but it feels like calling GoogleMapsOverlay.setMap() should result in displaying the deck.gl layers no matter when it is called, without requiring hacks/user interaction.

We have a hacky workaround to trick the map into re-rendering by changing the map center by an infinitesimal amount, but we shouldn't have to do that:

    const c = m.getCenter();
    m.setCenter(new gmAPI.LatLng(c.lat() + 0.000000000001, c.lng()));

I was also able to hack a fix by calling requestRedraw() in the _onAdd() method of GoogleMapsOverlay

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

  1. Initialize google.maps.Map()
  2. Wait some amount of time for data to arrive from a database.
  3. Initialize a deck.IconLayer and deck.GoogleMapsOverlay with the layer
  4. Call deck.GoogleMapsOverlay.setMap()
  5. Immediately see the icons displayed on the map

Steps to Reproduce

https://codepen.io/samschurter/pen/zYgOvdL

Environment

  • Framework version:
    • "@deck.gl/geo-layers": "^9.0.17",
    • "@deck.gl/google-maps": "^9.0.14",
    • "@deck.gl/layers": "^9.0.14",
  • Browser: Chrome 128
  • OS: MacOS 14.6

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant