---
title: "MTRasterLayer | Mobile sdk | Mobile sdk ios | Ios"
description: "The raster style layer renders raster map textures such as imagery."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# MTRasterLayer

```
public class MTRasterLayer : MTLayer, @unchecked Sendable, Codable
```

The raster style layer renders raster map textures such as imagery.

-   `[identifier](#/s:11MapTilerSDK13MTRasterLayerC10identifierSSvp)`
    
    Unique layer identifier.
    
    #### Declaration
    
    Swift
    
    ```
    public var identifier: String
    ```
    
-   `[type](#/s:11MapTilerSDK13MTRasterLayerC4typeAA11MTLayerTypeOvp)`
    
    Type of the layer.
    
    #### Declaration
    
    Swift
    
    ```
    public private(set) var type: MTLayerType { get }
    ```
    
-   `[sourceIdentifier](#/s:11MapTilerSDK13MTRasterLayerC16sourceIdentifierSSvp)`
    
    Identifier of the source to be used for this layer.
    
    #### Declaration
    
    Swift
    
    ```
    public var sourceIdentifier: String
    ```
    
-   `[maxZoom](#/s:11MapTilerSDK13MTRasterLayerC7maxZoomSdSgvp)`
    
    The maximum zoom level for the layer. Optional number between 0 and 24. At zoom levels equal to or greater than the maxzoom, the layer will be hidden.
    
    #### Declaration
    
    Swift
    
    ```
    public var maxZoom: Double?
    ```
    
-   `[minZoom](#/s:11MapTilerSDK13MTRasterLayerC7minZoomSdSgvp)`
    
    The minimum zoom level for the layer. Optional number between 0 and 24. At zoom levels less than the minzoom, the layer will be hidden.
    
    #### Declaration
    
    Swift
    
    ```
    public var minZoom: Double?
    ```
    
-   `[sourceLayer](#/s:11MapTilerSDK13MTRasterLayerC06sourceE0SSSgvp)`
    
    Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types.
    
    #### Declaration
    
    Swift
    
    ```
    public var sourceLayer: String?
    ```
    

[](#/Paint%20properties)

### Paint properties

-   `[brightnessMax](#/s:11MapTilerSDK13MTRasterLayerC13brightnessMaxSdSgvp)`
    
    Increase or reduce the brightness of the image. The value is the maximum brightness. Optional number between 0 and 1 inclusive. Defaults to 1.
    
    #### Declaration
    
    Swift
    
    ```
    public var brightnessMax: Double?
    ```
    
-   `[brightnessMin](#/s:11MapTilerSDK13MTRasterLayerC13brightnessMinSdSgvp)`
    
    Increase or reduce the brightness of the image. The value is the minimum brightness. Optional number between 0 and 1 inclusive. Defaults to 0.
    
    #### Declaration
    
    Swift
    
    ```
    public var brightnessMin: Double?
    ```
    
-   `[contrast](#/s:11MapTilerSDK13MTRasterLayerC8contrastSdSgvp)`
    
    Increase or reduce the contrast of the image. Optional number between -1 and 1 inclusive. Defaults to 0.
    
    #### Declaration
    
    Swift
    
    ```
    public var contrast: Double?
    ```
    
-   `[fadeDuration](#/s:11MapTilerSDK13MTRasterLayerC12fadeDurationSdSgvp)`
    
    Fade duration when a new tile is added. Units in milliseconds. Defaults to 300.
    
    #### Declaration
    
    Swift
    
    ```
    public var fadeDuration: Double?
    ```
    
-   `[hueRotate](#/s:11MapTilerSDK13MTRasterLayerC9hueRotateSdSgvp)`
    
    Rotates hues around the color wheel. Units in degrees. Defaults to 0.
    
    #### Declaration
    
    Swift
    
    ```
    public var hueRotate: Double?
    ```
    
-   `[opacity](#/s:11MapTilerSDK13MTRasterLayerC7opacitySdSgvp)`
    
    The opacity at which the image will be drawn. Optional number between 0 and 1 inclusive. Defaults to 1.
    
    #### Declaration
    
    Swift
    
    ```
    public var opacity: Double?
    ```
    
-   `[resampling](#/s:11MapTilerSDK13MTRasterLayerC10resamplingAA0D10ResamplingOSgvp)`
    
    The resampling/interpolation method to use for overscaling. Defaults to “linear”.
    
    #### Declaration
    
    Swift
    
    ```
    public var resampling: MTRasterResampling?
    ```
    
-   `[saturation](#/s:11MapTilerSDK13MTRasterLayerC10saturationSdSgvp)`
    
    Increase or reduce the saturation of the image. Optional number between -1 and 1 inclusive. Defaults to 0.
    
    #### Declaration
    
    Swift
    
    ```
    public var saturation: Double?
    ```
    

[](#/Layout%20properties)

### Layout properties

-   `[visibility](#/s:11MapTilerSDK13MTRasterLayerC10visibilityAA17MTLayerVisibilityOSgvp)`
    
    Whether this layer is displayed. Defaults to “visible”.
    
    #### Declaration
    
    Swift
    
    ```
    public var visibility: MTLayerVisibility?
    ```
    

[](#/Initializers)

### Initializers

-   `[init(identifier:sourceIdentifier:)](#/s:11MapTilerSDK13MTRasterLayerC10identifier16sourceIdentifierACSS_SStcfc)`
    
    Initializes the layer with required identifiers.
    
    #### Declaration
    
    Swift
    
    ```
    public init(
        identifier: String,
        sourceIdentifier: String
    )
    ```
    
-   `[init(identifier:sourceIdentifier:maxZoom:minZoom:sourceLayer:brightnessMax:brightnessMin:contrast:fadeDuration:hueRotate:opacity:resampling:saturation:visibility:)](#/s:11MapTilerSDK13MTRasterLayerC10identifier16sourceIdentifier7maxZoom03minJ00gE013brightnessMax0L3Min8contrast12fadeDuration9hueRotate7opacity10resampling10saturation10visibilityACSS_SSSdSgARSSSgA6rA0D10ResamplingOSgArA17MTLayerVisibilityOSgtcfc)`
    
    Initializes the layer with all options.
    
    #### Declaration
    
    Swift
    
    ```
    public init(
        identifier: String,
        sourceIdentifier: String,
        maxZoom: Double? = nil,
        minZoom: Double? = nil,
        sourceLayer: String? = nil,
        brightnessMax: Double? = 1.0,
        brightnessMin: Double? = 0.0,
        contrast: Double? = 0.0,
        fadeDuration: Double? = 300.0,
        hueRotate: Double? = 0.0,
        opacity: Double? = 1.0,
        resampling: MTRasterResampling? = .linear,
        saturation: Double? = 0.0,
        visibility: MTLayerVisibility? = .visible
    )
    ```
    

[](#/Codable)

### Codable

-   `[init(from:)](#/s:11MapTilerSDK13MTRasterLayerC4fromACs7Decoder_p_tKcfc)`
    
    Initializes the layer from the decoder.
    
    #### Declaration
    
    Swift
    
    ```
    public required init(from decoder: any Decoder) throws
    ```
    
-   `[encode(to:)](#/s:SE6encode2toys7Encoder_p_tKF)`
    
    #### Declaration
    
    Swift
    
    ```
    public func encode(to encoder: Encoder) throws
    ```
    
-   `[addToMap(_:)](#/s:11MapTilerSDK13MTRasterLayerC05addToA0yyAA9MTMapViewCF)`
    
    Adds layer to map DSL style.
    
    Prefer `[addLayer(_:)](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTStyle/#/s:11MapTilerSDK7MTStyleC8addLayeryyAA7MTLayer_pYaKF)` on MTMapView instead.
    
    #### Declaration
    
    Swift
    
    ```
    public func addToMap(_ mapView: MTMapView)
    ```
    
-   `[maxZoom(_:)](#/s:11MapTilerSDK13MTRasterLayerC7maxZoomyACXDSdF)`
    
    Modifier. Sets the `[maxZoom](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC7maxZoomSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func maxZoom(_ value: Double) -> Self
    ```
    
-   `[minZoom(_:)](#/s:11MapTilerSDK13MTRasterLayerC7minZoomyACXDSdF)`
    
    Modifier. Sets the `[minZoom](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC7minZoomSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func minZoom(_ value: Double) -> Self
    ```
    
-   `[sourceLayer(_:)](#/s:11MapTilerSDK13MTRasterLayerC06sourceE0yACXDSSF)`
    
    Modifier. Sets the `[sourceLayer](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC06sourceE0SSSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func sourceLayer(_ value: String) -> Self
    ```
    
-   `[brightnessMax(_:)](#/s:11MapTilerSDK13MTRasterLayerC13brightnessMaxyACXDSdF)`
    
    Modifier. Sets the `[brightnessMax](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC13brightnessMaxSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func brightnessMax(_ value: Double) -> Self
    ```
    
-   `[brightnessMin(_:)](#/s:11MapTilerSDK13MTRasterLayerC13brightnessMinyACXDSdF)`
    
    Modifier. Sets the `[brightnessMin](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC13brightnessMinSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func brightnessMin(_ value: Double) -> Self
    ```
    
-   `[contrast(_:)](#/s:11MapTilerSDK13MTRasterLayerC8contrastyACXDSdF)`
    
    Modifier. Sets the `[contrast](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC8contrastSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func contrast(_ value: Double) -> Self
    ```
    
-   `[fadeDuration(_:)](#/s:11MapTilerSDK13MTRasterLayerC12fadeDurationyACXDSdF)`
    
    Modifier. Sets the `[fadeDuration](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC12fadeDurationSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func fadeDuration(_ value: Double) -> Self
    ```
    
-   `[hueRotate(_:)](#/s:11MapTilerSDK13MTRasterLayerC9hueRotateyACXDSdF)`
    
    Modifier. Sets the `[hueRotate](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC9hueRotateSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func hueRotate(_ value: Double) -> Self
    ```
    
-   `[opacity(_:)](#/s:11MapTilerSDK13MTRasterLayerC7opacityyACXDSdF)`
    
    Modifier. Sets the `[opacity](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC7opacitySdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func opacity(_ value: Double) -> Self
    ```
    
-   `[resampling(_:)](#/s:11MapTilerSDK13MTRasterLayerC10resamplingyACXDAA0D10ResamplingOF)`
    
    Modifier. Sets the `[resampling](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC10resamplingAA0D10ResamplingOSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func resampling(_ value: MTRasterResampling) -> Self
    ```
    
-   `[saturation(_:)](#/s:11MapTilerSDK13MTRasterLayerC10saturationyACXDSdF)`
    
    Modifier. Sets the `[saturation](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC10saturationSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func saturation(_ value: Double) -> Self
    ```
    
-   `[visibility(_:)](#/s:11MapTilerSDK13MTRasterLayerC10visibilityyACXDAA17MTLayerVisibilityOF)`
    
    Modifier. Sets the `[visibility](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTRasterLayer/#/s:11MapTilerSDK13MTRasterLayerC10visibilityAA17MTLayerVisibilityOSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func visibility(_ value: MTLayerVisibility) -> Self
    ```
