Mapbox Support

The AerisMap.framework component of the SDK supports the use of Mapbox tiles with your weather maps in place of the default Apple Map tiles in MapKit. Mapbox support does not use the complete Mapbox iOS SDK, but instead relies on their small, easy-to-use MBXMapKit that works on top of Apple’s MapKit. Once custom raster overlays are fully supported with their new vector-based iOS SDK, we plan on transitioning to supporting their new mapping framework.

Adding Mapbox Support

There are additional steps required to prepare your project to use Mapbox tiles within your weather maps:

  1. Install the latest version of Mapbox’s MBXMapKit library into your project following the installation instructions provided by the library’s repository or Readme file. The version must be 0.8.0 or higher.
  2. Import the AerisMapboxMap.framework component of the AerisWeather iOS SDK into your project. This is an extension library on top of the core AerisMap.framework component that adds support for using Mapbox maps and data with the SDK.
  3. Set your weather map’s weatherMapType property to AWFWeatherMapTypeMapBox.
  4. Ensure you have provided a valid Mapbox map ID to use as the base overlay for your map by setting the weather map configuration’s mapboxMapId value. This must be done before passing your configuration object to a weather map at instantiation. Changing the mapboxMapId value after a weather map has been initialized will not change the base tile layer:
    AWFWeatherMapConfig *mapConfig = [AWFWeatherMapConfig config];
    mapConfig.mapboxMapId = @"__MAP_ID__";
    AWFWeatherMap *weatherMap = [AWFWeatherMap alloc] initWithMapType:AWFWeatherMapTypeMapBox config:mapConfig];
    let mapConfig = AWFWeatherMapConfig()
    mapConfig.mapboxMapId = "__MAP_ID__"
    let weatherMap = AWFWeatherMap(mapType: .mapbox, config: mapConfig)

Everything else regarding how data layers, overlays and annotations are handled for MapBox-based maps will function the same as the default Apple Maps implementation.

Last modified: July 30, 2020