[OpenLayers-Users] How to have overlays off by default

HKChad forums at 2kgt.com
Thu Jul 2 00:28:36 EDT 2009


You need to move the visibility option DOWN out of the params area.
If you look at the documentation,
http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS-js.html#OpenLayers.Layer.WMS.OpenLayers.Layer.WMS

You will see WMS takes 4 parameters, name, url, params, options

Visibility is an OPTION, not a params (params get sent as key/value pairs in
the URL query to the server).

so you need,

// CE
ce = new OpenLayers.Layer.WMS(
"CE", "http://localhost:8080/geoserver/wms",
{
width: '800',
layers: 'prof_reg:states50D_ce',
styles: '',
srs: 'EPSG:4269',
height: '317',
format: format,
transparent: true
},
{ singleTile: true, 
   ratio: 1,
   visibility: false,
   displayInLayerSwitcher: false
}
);

hope that helps,
Chad


Barker, Doug wrote:
> 
> Hi,
> How do I have the overlays in a map turned off when the map starts up?
> I tried the two items below (commented out).
> 
> // CE
> ce = new OpenLayers.Layer.WMS(
> "CE", "http://localhost:8080/geoserver/wms",
> {
> width: '800',
> layers: 'prof_reg:states50D_ce',
> styles: '',
> srs: 'EPSG:4269',
> height: '317',
> format: format,
> //displayInLayerSwitcher: false,
> //visibility: false,
> transparent: true
> },
> {singleTile: true, ratio: 1}
> );
> 
> Thanks
> Doug
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-have-overlays-off-by-default-tp3191421p3193414.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list