How to access the box coordinates as user changes Google Maps/Mapbox location?

I have only been playing around with the Google Maps plugin but I would like to access the coordinates of the map when the user navigates around, so I can update markers for that particular boundary. I am pulling markers via a SQL query and need to pass the coordinates in.

I believe this is a “bounds_changed” event per the API but I don’t see an event listener for this

Hi, we don’t expose this feature yet but we will add it to the roadmap ! Thanks very much for this great suggestion.

Is there a way to bind a search field that can be connected to something like Google locations API where users can search a location and then on click the map goes to that location?

Preferably this could work whether we use our own location data, google location API, or a combination (i’d like to mix in my use case)

Here’s how I got box coordinates as user changes drag with MapBox. Can also add for on zoom but I haven’t done it yet since you have to build your own “listener” like MapBox docs say

const map = variables[/* Mapbox - instance */ 'your-variable-id-goes-here-instance']
const bounds = map.getBounds();
return bounds;

You can also move to bounds:

const map = variables[/* Mapbox - instance */ 'your-variable-id-goes-here--instance']

map.fitBounds([

[-79.92600675662993, 36.52613992429005],

[-71.4088409740954, 40.72066532650368]]);

// see https://docs.mapbox.com/mapbox-gl-js/example/fitbounds/
1 Like

Hi @Matthew
I have a problem
that when init Map with weweb


I set the init center is lat 40 and lng -70
but it alway move to -146 and 41
how should I fix this?

Unfortunately I haven’t encountered that issue before; my only thought is you may have something else somehow controlling the center value being set. Wish I could help more!

1 Like

Thanks @Matthew
it because of the track resize option problem

and I have 1 more problem with mapbox sources


I added a source like this per this example

but it’s not work with weweb
how cant I set/add this to use?
(I have read docs but weweb dont touch about this part Mapbox | WeWeb Documentation)

Hi again Eric, unfortunately it’s been a long time since I’ve worked with Mapbox and I am unsure. However this may be related to your request, but I am not sure I understand you correctly - [solved] Mapbox Plugin - how do I bind sources / featurecollections

1 Like

such that
it solved with that ticket and a F5 :smile:
Thanks @Matthew