Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenLayers WMS Layer Transparency

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)"
like image 230
Colin05 Avatar asked Nov 30 '25 06:11

Colin05


1 Answers

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

like image 81
Tedd Avatar answered Dec 02 '25 18:12

Tedd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!