I’m trying to streamline my application and was wondering when does OpenLayers physically make the call to the WMS server? Further, does layer visibility play a role in the calls too?
Does it happen when you instantiate a layer
var layer = new OpenLayers.Layer.WMS("MyLayer"...
or after you add the layer to the map?
map.addLayer(layer);
Thanks for your help!
It makes the call(s) when you add the layer. However, It’s not what you think. Unlike a WFS call which creates a WFS request and gets a WFS response. A WMS Layer works differently. When you instantiate the layer openlayers will calculate all the tiles it needs based on size. Then when you add the layer openlayers generates html that make the request(s) via simple GET requests that happen via the
<img src=...So for example it might generate the html that has 4 images where the IMG element SRC equals a call to your WMS service that returns a tile that openlayers will use to layout. somethign like :Look at this html inspect example:
I recommend this article to help you understand it.