简体   繁体   English

OpenLayers WMS 图层透明度

[英]OpenLayers WMS Layer Transparency

I was wondering how to make a wms layer transparent using openlayers.我想知道如何使用 openlayers 使 wms 层透明。

The current javascript for each non transparent layer is below:每个非透明层的当前 javascript 如下:

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.对于ol.layer.Tile您可以设置其opacity以使其透明。

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或者将它全部隐藏在一起使用visible: false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM