MGLRasterSource

@interface MGLRasterSource : MGLSource

A raster tile source.

  • URL

    A URL to a TileJSON resource. Supported protocols are http:, https:, and mapbox://<mapid>.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSURL *_Nonnull URL;

    Swift

    var url: URL { get }
  • The minimum visual size to display tiles for this source. Units in pixels. Defaults to 512 on each tile side.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) NSUInteger tileSize;

    Swift

    var tileSize: UInt { get }
  • The tile set used to locate and download tiles.

    A tile set holds the raster tile URL template strings and associated configuration for those strings. It can be passed in place of the URL to TileJSON in order to create a source configured to download tiles from ordinary web URLs.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) MGLTileSet *tileSet;

    Swift

    var tileSet: MGLTileSet? { get }
  • Initializes a source with the given identifier, TileJSON configuration URL, and tile size.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSourceIdentifier:
                                (nonnull NSString *)sourceIdentifier
                                                 URL:(nonnull NSURL *)url
                                            tileSize:(CGFloat)tileSize;

    Swift

    init(sourceIdentifier: String, url: URL, tileSize: CGFloat)

    Parameters

    sourceIdentifier

    A string that uniquely identifies the source.

    url

    A URL to a TileJSON resource.

    tileSize

    The minimum visual size to display tiles for the source.

  • Initializes a source with the given identifier, tile size, and tile URL template set.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSourceIdentifier:
                                (nonnull NSString *)sourceIdentifier
                                             tileSet:(nonnull MGLTileSet *)tileSet
                                            tileSize:(CGFloat)tileSize;

    Swift

    init(sourceIdentifier: String, tileSet: MGLTileSet, tileSize: CGFloat)

    Parameters

    sourceIdentifier

    A string that uniquely identifies the source.

    tileSet

    A tile set describing where to download tiles.

    tileSize

    The minimum visual size to display tiles for the source.