MGLRasterSource
@interface MGLRasterSource : MGLSource
A raster tile source.
-
Returns a raster source initialized with an identifier, TileJSON configuration URL, and tile size.
After initializing and configuring the source, add it to a map view’s style using the
-[MGLStyle addSource:]
method.Declaration
Objective-C
- (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier URL:(nonnull NSURL *)url tileSize:(CGFloat)tileSize;
Swift
init(identifier: String, url: URL, tileSize: CGFloat)
Parameters
identifier
A string that uniquely identifies the source in the style to which it is added.
url
A URL to a TileJSON configuration file describing the source’s contents and other metadata.
tileSize
The height and width (measured in points) at which to display each tile in this source when the map’s zoom level is an integer.
Return Value
An initialized raster source.
-
Returns a raster source initialized with the given identifier, tile size, and tile set.
After initializing and configuring the source, add it to a map view’s style using the
-[MGLStyle addSource:]
method.Declaration
Objective-C
- (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier tileSet:(nonnull MGLTileSet *)tileSet tileSize:(CGFloat)tileSize;
Swift
init(identifier: String, tileSet: MGLTileSet, tileSize: CGFloat)
Parameters
identifier
A string that uniquely identifies the source in the style to which it is added.
tileSet
A tile set describing the source’s contents and other metadata.
tileSize
The height and width (measured in points) at which to display each tile in this source when the map’s zoom level is an integer.
Return Value
An initialized raster source.
-
A URL to a TileJSON configuration file describing the source’s contents and other metadata.
The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the tile set’s map ID (
mapbox://<mapid>
).Declaration
Objective-C
@property (readonly, copy, nonatomic) NSURL *_Nonnull URL;
Swift
var url: URL { get }
-
The height and width (measured in points) at which to display each tile in this source when the map’s zoom level is an integer.
A tile may be scaled up or down when the zoom level is between two integers.
The default value of this property is 512 points.
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 }