Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps Data Layer, Click on geometry programmatically

I have a google map where I load geometry data to the data layer using geoJSON. I bind to the following event in the data layer.

map.data.addListener('click', function (event) { console.log(event);});

How can I trigger this event manually? I know I can trigger the click event on a marker manually, but it is triggered through google.maps.event.

like image 669
Amila Avatar asked Dec 08 '25 21:12

Amila


1 Answers

That should be done with google.maps.event.trigger.

Try this (not sure):

// invoke a click
google.maps.event.trigger(map.data, 'click');
like image 164
Emmanuel Delay Avatar answered Dec 11 '25 22:12

Emmanuel Delay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!