Updating Map Layer Opacity

When using AerisWeather Maps weather layers in a weather map, you can use more customization options by using instances of AWFRasterMapLayer and added them to your weather map. In this case, you will often be accessing the amp property on your AWFWeatherMap instance, which is just the tile content source provider responsible for managing all Maps layers on the map.

For instance, you can specify a custom opacity value for a single layer by using the AWFRasterMapLayer class and adding it to your weather map at instantiation:

AWFRasterMapLayer *tempsLayer = [AWFRasterMapLayer layerWithLayerType:AWFMapLayerTemperatures];
tempsLayer.alpha = 0.5;
[self.weatherMap.amp addRasterLayer:tempsLayer];
let tempsLayer = AWFRasterMapLayer(layerType: .temperatures)
tempsLayer.alpha = 0.5

However, you may need to update the opacity on a layer or for all layers after the layer has already been added to the weather map, such as in response to a slide control. You can also achieve this by getting the AWFRasterMapLayer instance and updating it’s alpha property for a single Maps layer:

AWFRasterMapLayer *tempsLayer = [self.weatherMap.amp rasterLayerForLayerType:AWFMapLayerTemperatures];
if (tempsLayer) {
    tempsLayer.alpha = 0.7;
if let tempsLayer = weatherMap.amp.rasterLayer(forLayerType: .temperatures) {
    tempsLayer.alpha = 0.7

Alternatively, you can set the opacity for all AerisWeather Maps layers by accessing the AWFTileSource associated with all Maps layers and setting it’s alpha property:

self.weatherMap.amp.tileLayer.alpha = 0.5;
weatherMap.amp.tileLayer.alpha = 0.5

Refer to the AWFRasterMapLayer class documentation for additional information on customizing individual Maps layers.

Last modified: July 26, 2021