MTRasterTileSource
public class MTRasterTileSource : MTTileSource, @unchecked Sendable
A raster tile source.
For raster tiles hosted by MapTiler, the “url” value should be of the form
https://api.maptiler.com/tiles/[tilesetid]/tiles.json?key=
-
Unique identifier of a source.
Declaration
Swift
public var identifier: String -
An array containing the longitude and latitude of the southwest and northeast corners of the source’s bounding box in the following order: [sw.lng, sw.lat, ne.lng, ne.lat].
Note
Defaults to [-180, -85.051129, 180, 85.051129].Declaration
Swift
public var bounds: [Double] -
Maximum zoom level for which tiles are available.
Note
Defaults to 22.Declaration
Swift
public var maxZoom: Double -
Minimum zoom level for which tiles are available.
Note
Defaults to 0.Declaration
Swift
public var minZoom: Double -
Scheme used for tiles.
Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed.
Declaration
Swift
public var scheme: MTTileScheme -
The minimum visual size to display tiles for this layer. Units in pixels.
Note
Defaults to 512. Only configurable for raster layers.Declaration
Swift
public var tileSize: Int -
An array of one or more tile source URLs.
Declaration
Swift
public var tiles: [URL]? -
A URL to a TileJSON resource. Supported protocols are http, https.
Declaration
Swift
public var url: URL? -
Attribution to be displayed when the map is shown to a user.
Declaration
Swift
public var attribution: String? -
Type of the source.
Declaration
Swift
public private(set) var type: MTSourceType { get } -
Initializes the source with unique id and url to TileJSON resource.
Declaration
Swift
public init(identifier: String, url: URL) -
Initializes the source with unique id and one or more tile source urls.
Declaration
Swift
public init(identifier: String, tiles: [URL]) -
Initializes the source with all options.
Declaration
Swift
public init( identifier: String, bounds: [Double], maxZoom: Double, minZoom: Double, scheme: MTTileScheme, tileSize: Int = 512, tiles: [URL]? = nil, url: URL? = nil, attribution: String? = nil ) -
Sets the url of the source.
Used for updating the source data.
Declaration
Parameters
urlurl to Raster Tile resource.
mapViewMTMapView which holds the source.
completionHandlerA handler block to execute when function finishes.
-
Sets the tiles of the source.
Used for updating the source data.
Declaration
Parameters
tileslist of urls with tile resources.
mapViewMTMapView which holds the source.
completionHandlerA handler block to execute when function finishes.
-
setURL(url:Asynchronousin: ) Sets the url of the source.
Used for updating the source data.
Declaration
Swift
@MainActor public func setURL(url: URL, in mapView: MTMapView) asyncParameters
urlurl to Raster Tile resource.
mapViewMTMapView which holds the source.
-
setTiles(tiles:Asynchronousin: ) Sets the tiles of the source.
Used for updating the source data.
Declaration
Swift
@MainActor public func setTiles(tiles: [URL], in mapView: MTMapView) asyncParameters
tileslist of urls with tile resources.
mapViewMTMapView which holds the source.
-
Adds source to map DSL style.
Prefer
addSource(_:)on MTMapView instead.Declaration
Swift
public func addToMap(_ mapView: MTMapView)