3

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)"
Colin05
  • 31
  • 1
  • 2

1 Answers1

4

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

Tedd
  • 264
  • 1
  • 8