I was wondering how to make a wms layer transparent using openlayers.
The current javascript for each non transparent layer is below:
var lyr_GDPSETAAirtemperatureC = new ol.layer.Tile({
source: new ol.source.TileWMS(({
url: "http://weatherservice",
params: {"LAYERS": "GDPS.ETA_TT", "TILED": "true"},
})),
title: "Air temperature (°C)"
For a ol.layer.Tile you could set its opacity to make it transparent.
new ol.layer.Tile({
opacity: 0.5,
visible: true,
source: new ol.source.TileWMS(({
url: "http://weatherservice",
params: {"LAYERS": "GDPS.ETA_TT", "TILED": "true"},
}))
Or to hide it all together use visible: false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With