Issue with Google Maps fit_bounds

Hi there,

I have been facing misbehavior of the Google Maps functions for several weeks now.
After heavy testing, I was able to identify the core of the issue and am able to reproduce it in different setups. The issue occurs when I use Google Maps API trying to set the map to bounds, e.g. with

self.map_1.fit_bounds(bounds)

Though the bounds object seems to be created correctly, it does not properly align with the map as expected. However, the issue only occurs when I receive coordinates from a data table and does not happen when I create the bounds out of coordinates directly within the Python code. All values and properties are exactly the same, no matter if I receive the values from the data table to generate it or if I iterate through a list of coordinates in the python function itself. However, the fit_to_bound function behaves differently.

Strangely, the difference only occurs if I call the function directly from Python. However, when I call the exact same function e.g. by clicking on a button, it does work as expected.

I created a sample app for reference. The create_map() function is called in the init as well as when the bottom on top of the page is clicked.

https://anvil.works/build#clone:HQ7Q6S56ZDDSWZVC=56PXNX6UCPC2WAH5RE7HCOT6

I am not able to identify the cause of this strange behavior. Would be awesome if you can take a look into it.

Best
DS

A post was merged into an existing topic: Issue with Google Maps-API: fit_bounds does not work