I have a map with one ImageLayer, with its source an ImageStatic. My page first loads the map with one image. Once a user presses a button, I want the ImageStatic to change to another predefined image (with the change reflected on the map). How can I accomplish this in OpenLayers?
asked Jul 17, 2023 at 21:43
Saddy
1,5911 gold badge13 silver badges21 bronze badges
-
you need to update the sourceBR75– BR752023年07月18日 06:54:57 +00:00Commented Jul 18, 2023 at 6:54
-
If you define two sources you can update the layer openlayers.org/en/latest/examples/lazy-source.htmlMike– Mike2023年07月18日 08:56:19 +00:00Commented Jul 18, 2023 at 8:56
-
I was hoping to be able to trigger a rerender and reuse the existing source, but that should also work. Thanks!Saddy– Saddy2023年07月18日 15:54:11 +00:00Commented Jul 18, 2023 at 15:54
lang-js