[OpenLayers-Users] Prevent first base layer from loading
Steven Lagerweij
steven at t41.nl
Thu Nov 27 15:47:27 EST 2008
Hi,
Is it possible to prevent the first base layer from loading the tiles if
it is not the selected base layer?
I now resorted to making the selected base layer first in the list when
setting up the map, but maybe I missed something to get it to work
properly (2.7)?
Looking at the Map.js addLayers([]), it will always make the first base
layer it encounters the baselayer if there isn't one set yet (also if
that is not visible). However, you cannot use setBaseLayer before the
layer is added.
While playing with this I noticed that for Google layers you cannot use
the visibility property. If you use visibility:false on a 2nd google
layer nothing shows up anymore (also not the one with visibility:true),
while the tiles seem to be loaded.
This can also be seen if you modify the google.html example to add
visibility properties;
...
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP, visibility: true}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets", {visibility: false}
);
...
This does not seem to cause problems with, for example, 2 TMS layers.
More information about the Users
mailing list