[OpenLayers-Users] How to add an overlay to the map,
but not select it by default
Alexandre Dube
adube at mapgears.com
Fri Jun 26 08:55:14 EDT 2009
Hi,
Adrian Popa wrote:
> Hello everyone,
>
> I'm trying to add several overlay layers (from mapserver) to an
> openlayers map. Everything works as expected, but when the map loads,
> all the overlay layers are selected. I would like to have the ability
> (programmatically) to select which layers are selected by default.
> Here's an example of how I enable an overlay layer:
>
> var rtc = new OpenLayers.Layer.MapServer("Test",
> "http://terra/cgi-bin/mapserv", { map='/var/www/html/map/rtc.map',
> transparent:true, format:'png',
> map_imagetype: 'agg',layers: 'mylayer', maxExtent: new
> OpenLayers.Bounds(20.26, 43.16, 29.70, 48.46), maxResolution:
> 156543,units: 'm'},
> { isBaseLayer:false, projection: sphericalMercator, singleTile: 'true'});
>
>
Add visibility:false to your options :
{ isBaseLayer:false, projection: sphericalMercator, singleTile: 'true', visibility:false}
> map.addLayers([rtc]);
>
> I was unable to find a method in the documentation to allow me to
> 'deselect' specific layers. If there is, I would appreciate a pointer.
>
> Thanks in advance,
> Adrian
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list