Skip to main content

WeatherRadar Layer

The alk.layer.WeatherRadarLayer layer is used to overlay live weather radar imagery on your map. The opacity parameter allows you to specify the transparency of the weather imagery in the range of 0 to 1, 0 being completely transparent, 1 being opaque, and 0.5 being at 50% transparency. The opacity can be changed at any time using the layer’s setOpacity function.

 
1
var base = new alk.layer.BaseMapLayer();
2
var radar = new alk.layer.WeatherRadarLayer({
3
  opacity: 0.75
4
});
5
6
var map = new ol.Map({
7
  target: 'map',
8
  layers: [base, radar],
9
  view: new ol.View({
10
    center: ol.proj.transform([-96, 38], alk.val.SRS.EPSG4326, alk.val.SRS.EPSG3857),
11
    zoom: 4
12
  }),
13
  controls: ol.control.defaults({
14
    attributionOptions: {
15
      collapsible: true
16
    }
17
  })
18
});
19
Last updated November 23, 2021.