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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.