How to make Map widget recenter

I have two apps using the Google Maps Widget. In both cases the map gets coordinates from a mysql query (lets call it lookup_places), but they do it differently.

In the first one, the Default Markers field has JS to filter the lookup_places data against the key that is selected in a Select widget and use the corresponding lat/long columns. This works well, and every time I select a new place from that dropdown the map reactively recenters on the new coordinates.

In the second app, I have two text widgets (Lat and Long) that get their values from the lookup_places data in various ways. In this case, the map Default Markers references those Text widgets. When the text in those widgets changes, the marker on the Map widget changes accordingly, but the map doesn’t recenter on the new marker.

What drives the recentering and how do I control it?

Hi! Could you share some screenshots or a loom.com screen recording of the two behaviors? Please also show the properties pane of the Maps widgets and the evaluated values of the Default markers.

For the scenario where the Map does not center, is the data type of your Input widgets Number?

The widgets that the map gets the coordinates from are Text widgets, not Input. Not seeing a “data type” property for that widget.

Can you please confirm if the coordinates are sent as strings or numbers? The map should center if the values are numeric.
E.g., you can use Number(TEXT_lat.text) or parseFloat(TEXT_lat.text) to convert them to numeric values.

That did the trick - thank you, @Amelia !

Hi @Amelia - I’m noticing that the recentering works but the marker is no longer displayed. I think at the time of my last comment it did, but I can’t remember. Just tried with a fresh Map widget and seeing the same behavior. Did something get broken?

Hello @trebuchet! Indeed, this functionality got broken, but the fix for it will be available soon: https://github.com/appsmithorg/appsmith/pull/20274
Sorry for the inconvenience.