Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change image of google.maps.GroundOverlay using javascript?

I am using Google Maps for a weather information display web.

I want to show the cloud condition for past seven days.

I am using overlays to display clouds on my web.

Now my question is can we change image of google.maps.GroundOverlay using javascript?

like image 907
Jatin Dhoot Avatar asked Feb 01 '26 11:02

Jatin Dhoot


1 Answers

I believe it is not possible to change the image of a GroundOverlay. The image is set in the constructor and there is currently no setter documented to change it.

What you could try is to create two GroundOverlays with the same coordinates but pass the constructor map:null on one of them so it doesn't show on your map. Then, when you want to replace the image, call setMap(null) on the overlay that is showing--that will hide it--and then call setMap(map) (assuming you set your map to a variable named map) on the overlay that you want to show.

like image 193
Trott Avatar answered Feb 03 '26 03:02

Trott



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!