Map Data Layers

A weather map can display a variety of different weather data elements at once, such as radar and satellite or earthquakes and storm reports. You have full control over which data layers are displayed on your weather maps and can toggle their visibility at any time during runtime within your application.

Available Data Layers

For the full listing of weather data layers currently supported, review the Data Layer Types reference matrix.

Heads Up! Adding and removing tile/image map layers using the iOS SDK will count against your account's allowed daily map units, and animating these tile/image layers can consume your allowed map units quickly. Refer to the AerisWeather Maps Accesses documentation for more information regarding how map units are calculated. You can determine which data layers are tile/image layers using the global function AWFIsTileLayerType(AWFDataLayerType layerType) within the AerisMaps.framework of the SDK.

Adding and Removing Data Layers

Displaying a new weather data layer on your map is as simple as calling a single method on your AWFWeatherMap instance:

[self.weatherMap addLayerType:AWFLayerTypeRadar];

You can also insert data layers relative to other existing data layers:

[self.weatherMap addLayerType:AWFLayerTypeRadar aboveLayerType:AWFLayerTypeSatellite];
[self.weatherMap addLayerType:AWFLayerTypeSatellite belowLayerType:AWFLayerTypeRadar];
weatherMap.add(.typeRadar, above: .typeSatellite)
weatherMap.add(.typeSatellite, below: .typeRadar)

Additionally, you can insert weather data layers relative to other non-weather overlays already on your map. The specified overlay but be a valid overlay object depending on which mapping library you are using. For instance, with Apple’s MapKit the overlay must conform to the MKOverlay protocol:

[self.weatherMap addLayerType:AWFLayerTypeRadar aboveOverlay:customOverlay];
[self.weatherMap addLayerType:AWFLayerTypeRadar belowOverlay:customOverlay];
weatherMap.add(.typeRadar, aboveOverlay: customOverlay)
weatherMap.add(.typeSatellite, belowOverlay: customOverlay)

Some layer types will always remain above others, such as radar and satellite will always appear above full-coverage layers like temperatures and wind speeds.

Removing an existing weather data layer from the map is just as simple as adding one. If the data layer is not currently active on the map, this method will not do anything:

[self.weatherMap removeLayerType:AWFLayerTypeRadar];

Multiple data layers can be added to and removed from the map at once using the available convenience methods. An array of layer enumeration types must be provided:

[self.weatherMap addLayerTypes:@[@(AWFLayerTypeRadar), @(AWFLayerTypeSatellite)]];
[self.weatherMap removeLayerTypes:@[@(AWFLayerTypeRadar), @(AWFLayerTypeSatellite)]];
let layers: [AWFLayerType] = [.typeRadar, .typeSatellite]

Working With Data Layers

Sometimes you may need to check if a certain data layer is currently active on your map, or you may need to access the managing layer object that’s associated with a specific data layer type. To check if a data layer type is currently visible, use containsLayerType: on your weather map instance, which will return YES if the layer is active, or NO if not:

BOOL isRadarActive = [self.weatherMap containsLayerType:AWFLayerTypeRadar];
let isRadarActive = weatherMap.contains(.typeRadar)

If a layer type is active, you can also access the managing layer object that’s associated with it which will be a subclass of AWFDataLayer and will be based on the type of layer (e.g., tile, image, point data, or polygon). For instance, getting the layer object for AWFLayerTypeRadar will return an instance of AWFTileDataLayer, whereas the layer object for AWFLayerTypeEarthquake will be an instance of AWFPointDataLayer:

AWFDataLayer *radarLayer = [self.weatherMap dataLayerForType:AWFLayerTypeRadar];
NSLog(@"radarLayer class: %@", NSStringFromClass([radarLayer class]));          // outputs "AWFTileDataLayer”
if let radarLayer = weatherMap.dataLayer(for: .typeRadar) {
	print("radarLayer: \(radarLayer)")

Updating Data Layers

Once a data layer has been added to the map, you can force its data to update as needed. You can update either update a single data layer or all active layers at the same time:

// update a specific layer type
[self.weatherMap refreshLayerType:AWFLayerTypeRadar];

// update all active layer types
[self.weatherMap refreshAllLayerTypes];
// update a specific layer type

// update all active layer types

For tile and image overlays, this process will invalidate the current image or tiles on the map, request the most recent imagery available for that layer, and then force the overlay to re-render. For point and polygon data layers, the latest data will be requested and once the request is successful, the old overlay objects will be removed and replaced by the new objects on the map.

You can set your weather map to automatically update its active data layers by calling enableAutoRefresh on your weather map instance. This will call refreshAllLayerTypes repeatedly based on the time interval you define for refreshInterval in your weather map’s configuration object. It is recommended to also call disableAutoRefresh when the view controller containing your weather map is about to disappear:

- (void)viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];
	[self.weatherMap enableAutoRefresh];

- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
	[self.weatherMap disableAutoRefresh];
override func viewDidAppear(_ animated: Bool) {

override func viewWillDisappear(_ animated: Bool) {

Last modified: July 30, 2020