MTRasterDEMSource

public class MTRasterDEMSource : MTTileSource, @unchecked Sendable

A raster DEM source. Only supports Terrain RGB.

  • 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
  • The minimum visual size to display tiles for this layer. Units in pixels.

    Note

    Defaults to 512.

    Declaration

    Swift

    public var tileSize: Int
  • DEM encoding format. Defaults to Terrain RGB (mapbox).

    Declaration

    Swift

    public var encoding: MTRasterDEMEncoding
  • An array of one or more tile source URLs.

    Declaration

    Swift

    public var tiles: [URL]?
  • 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,
        tileSize: Int = 512,
        encoding: MTRasterDEMEncoding = .mapbox,
        tiles: [URL]? = nil,
        url: URL? = nil,
        attribution: String? = nil
    )
  • Sets the url of the source.

    Declaration

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func setURL(url: URL, in mapView: MTMapView, completionHandler: ((Result<Void, MTError>) -> Void)? = nil)
  • Sets the tiles of the source.

    Declaration

    Swift

    @MainActor
    public func setTiles(
        tiles: [URL],
        in mapView: MTMapView,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )
  • setURL(url:in:) Asynchronous

    Sets the url of the source.

    Declaration

    Swift

    @MainActor
    public func setURL(url: URL, in mapView: MTMapView) async
  • setTiles(tiles:in:) Asynchronous

    Sets the tiles of the source.

    Declaration

    Swift

    @MainActor
    public func setTiles(tiles: [URL], in mapView: MTMapView) async
  • Adds source to map DSL style.

    Prefer addSource(_:) on MTMapView instead.

    Declaration

    Swift

    public func addToMap(_ mapView: MTMapView)