[OpenLayers-Users] layer switcher problem..

Alexander Petkov greenkov at gmail.com
Sun Apr 12 19:10:14 EDT 2009


On Sun, Apr 12, 2009 at 4:03 PM, MeLv1n wAuRaN <melvinnesta at gmail.com> wrote:
>
> Hi alexander,
>
> thanks for the quick reply. actually not all my layers but only some of my
> layers. i tried including the visibility but it didn't work. maybe you can
> check my codes:
>
> layer_jalan = new OpenLayers.Layer.WMS( "Jalan",
>
> "http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Skripsi/coba.map",
>              {layers: 'jalan',
>              transparent: "true", format: "image/png"},
>              {singleTile: true},
>              {visibility: false});
>
Try this:

 layer_jalan = new OpenLayers.Layer.WMS( "Jalan",
 "http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Skripsi/coba.map",
              {layers: 'jalan',
              transparent: "true", format: "image/png"},
              {singleTile: true, visibility: false});

'singleTile' and 'visibility' go together in the options hashtable:
http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers/Layer/WMS-js.html#OpenLayers.Layer.WMS.OpenLayers.Layer.WMS

Alex



More information about the Users mailing list