Setting Layer Visibility in OL3

المشرف العام

Administrator
طاقم الإدارة
I am trying to toggle visibility of a GeoServer WMS layer.

The code below doesn't render the layer, regardless of if setVisibility is true or false

var countryParks = new ol.layer.Tile({ title: 'Country Parks', source: new ol.source.TileWMS({ url: 'http://localhost:8080/geoserver/opengeo/wms', params: {"LAYERS": 'opengeo:country_parks'}, serverType: 'geoserver' }),});countryParks.setVisibility(true);map.addLayer(countryParks);And this code does render the layer, true or false regardless

var countryParks = new ol.layer.Tile({ title: 'Country Parks', visiblity: false, source: new ol.source.TileWMS({ url: 'http://localhost:8080/geoserver/opengeo/wms', params: {"LAYERS": 'opengeo:country_parks'}, serverType: 'geoserver' }),});map.addLayer(countryParks);How does one toggle layer visibility, if not as in these attempts?



أكثر...
 
أعلى