Managing Map Data Sources

A weather map can display a variety of different weather data sources at once, such as radar, satellte, earthquakes and storm cells. You can complete control over which data sources appear on your weather map and can add or remove them at any time while your application is running.

Data Types

There are three primary data types for a weather map: raster/tile, point and shape:

  • Raster/Tile: A raster image or tile layer, such as radar or temperatures.

  • Point: A series of map annotations representing point data, such as earthquakes or storm reports.

  • Shape: Vector polyline and/or polygon data, such as convective outlooks.

Refer to AWFMapLayer and the associated constants (Objective-C) or enumerated values (Swift) for the supported raster, point and shape types.

Heads Up! Due to memory limitations on mobile devices and to improve overall map performance, all raster layer types are merged into a single AerisWeather Maps request so that only a single image or tile is loaded for multiple layers rather than making multiple requests, one for each AerisWeather Maps layer type, and loading each into its own raster overlay on the map.

This does not include point or shape layer types as their data comes from the AerisWeather API and does not use Maps layers.

Adding Data Sources

To add a new data source to your weather map, you need to create your source instance, which may be an instance of AWFTileSource, AWFPointSource, or AWFShapeSource depending on the type of data you want to display. You'll also need to know the layer type that corresponds to the dataset you want to add, which will either by an AWFMapLayer, AWFMapLayer or AWFMapLayer value:

AWFTileSource *radarSource = [[AWFTileSource alloc] initWithLayerType:AWFMapLayerRadar];
[self.weatherMap addSource:radarSource];
let radarSource = AWFTileSource(layerType: .radar)

Alternatively, an easier method to adding data sources to your weather map is to just add them using the associated layer type and letting AWFWeatherMap setup the source objects accordingly:

[self.weatherMap addSourceForLayerType:AWFMapLayerRadar];
weatherMap.addSource(forLayerType: .radar)

You can also add multiple data sources at once:

// add sources by instances
[self.weatherMap addSources:@[radarSource, advisoriesSource]];
// add sources by layer types
[self.weatherMap addSourcesForLayerTypes:@[AWFMapLayerRadar, AWFMapLayerAdvisories]];   
// add sources by instances
weatherMap.addSources([radarSource, advisoriesSource])
// add sources by layer types
weatherMap.addSources(forLayerTypes: [.radar, .advisories])

Working With AerisWeather Maps Layers

A weather map instance will automatically handle raster AerisWeather Maps content for basic usage, such as adding and removing layers, using the AWFMapLayer type. While this works in most use cases, you may want to use the more advanced Maps features, such as controlling opacity, adding filters or including text labels.

To learn more about how to work with these advanced Maps features, check out our Using Maps Features guide.

Removing Data Sources

Removing data sources is similar to adding them by passing in the data source instance you want to remove:

[self.weatherMap removeSource:radarSource];

Or, you can remove the data source associated with a specific layer type:

[self.weatherMap removeSourceForLayerType:AWFMapLayerRadar];
weatherMap.removeSource(forLayerType: .radar)

If the weather map does not contain the data source or a data source for the specified layer type, then this method will do nothing.

You can also remove multiple data sources at once:

// add sources by instances
[self.weatherMap removeSources:@[radarSource, advisoriesSource]];
// add sources by layer types
[self.weatherMap removeSourcesForLayerTypes:@[AWFMapLayerRadar, AWFMapLayerAdvisories]];    
// remove sources by instances
weatherMap.removeSources([radarSource, advisoriesSource])
// remove sources by layer types
weatherMap.removeSources(forLayerTypes: [.radar, .advisories])

Working With Data Sources

When working with your weather map, you may need to check if a data source is currently active. To do so, you can either use a data source instance or layer type:

// check by passing a data source instance
BOOL isRadarActive = [self.weatherMap.sources containsObject:radarSource];

// check using a layer type
BOOL isRadarActive = [self.weatherMap containsSourceForLayerType:AWFMapLayerRadar];
// check by passing a data source instance
let isRadarActive = weatherMap.sources.contains(radarSource)
// check using a layer type
let isRadarActive = weatherMap.containsSource(forLayerType: .radar)

You can also return the data source instance associated for a particular layer type if it exists on the weather map:

AWFMapContentSource *source = [self.weatherMap sourceForLayerType:AWFMapLayerRadar];
let source = weatherMap.source(forLayerType: .radar)

Once a weather map has already been initialized and data sources added, you can force the map to refresh a single or all data sources. This is often useful when your application returns from the background and your weather map needs to update its content. Use the refreshAllSources method on your weather map:

[self.weatherMap refreshAllSources];

You can also configure your weather map to automatically refresh its data sources at a regular interval. Just call enableAutoRefresh to start the refresh timer, typically when the view containing your weather map appears. Then make sure to call disableAutoRefresh when your weather map is no longer visible in your application:

- (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) {

Refer to the refreshInterval documentation on AWFWeatherMapConfig for more information regarding this setting.

Last modified: August 02, 2021