MGLRasterStyleLayer
@interface MGLRasterStyleLayer : MGLForegroundStyleLayer
An MGLRasterStyleLayer
is a style layer that renders raster tiles on the map.
Use a raster style layer to configure the color parameters of raster tiles
loaded by an MGLRasterSource
object. For example, you could use a raster
style layer to render Mapbox
Satellite imagery, a raster tile
set uploaded to Mapbox Studio, or a raster map authored in TileMill, the classic
Mapbox Editor, or Mapbox Studio Classic.
You can access an existing raster style layer using the
-[MGLStyle layerWithIdentifier:]
method if you know its identifier;
otherwise, find it using the MGLStyle.layers
property. You can also create a
new raster style layer and add it to the style using a method such as
-[MGLStyle addLayer:]
.
Example
let layer = MGLRasterStyleLayer(identifier: "clouds", source: source)
layer.rasterOpacity = MGLStyleValue(rawValue: 0.5)
mapView.style?.addLayer(layer)
-
Returns a raster style layer initialized with an identifier and source.
After initializing and configuring the style layer, add it to a map view’s style using the
-[MGLStyle addLayer:]
or-[MGLStyle insertLayer:belowLayer:]
method.Declaration
Objective-C
- (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier source:(nonnull MGLSource *)source;
Swift
init(identifier: String, source: MGLSource)
Parameters
identifier
A string that uniquely identifies the source in the style to which it is added.
source
The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.
Return Value
An initialized foreground style layer.
-
Increase or reduce the brightness of the image. The value is the maximum brightness.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float1
. Set this property tonil
to reset it to the default value.This attribute corresponds to the
raster-brightness-max
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *maximumRasterBrightness;
Swift
var maximumRasterBrightness: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
maximumRasterBrightness
property.This property corresponds to the
raster-brightness-max-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition maximumRasterBrightnessTransition;
Swift
var maximumRasterBrightnessTransition: MGLTransition { get set }
-
Increase or reduce the brightness of the image. The value is the minimum brightness.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This attribute corresponds to the
raster-brightness-min
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *minimumRasterBrightness;
Swift
var minimumRasterBrightness: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
minimumRasterBrightness
property.This property corresponds to the
raster-brightness-min-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition minimumRasterBrightnessTransition;
Swift
var minimumRasterBrightnessTransition: MGLTransition { get set }
-
Increase or reduce the contrast of the image.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterContrast;
Swift
var rasterContrast: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
rasterContrast
property.This property corresponds to the
raster-contrast-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition rasterContrastTransition;
Swift
var rasterContrastTransition: MGLTransition { get set }
-
Fade duration when a new tile is added.
This property is measured in milliseconds.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float300
. Set this property tonil
to reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
Swift
var rasterFadeDuration: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
rasterFadeDuration
property.This property corresponds to the
raster-fade-duration-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition rasterFadeDurationTransition;
Swift
var rasterFadeDurationTransition: MGLTransition { get set }
-
Rotates hues around the color wheel.
This property is measured in degrees.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This attribute corresponds to the
raster-hue-rotate
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotation;
Swift
var rasterHueRotation: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
rasterHueRotation
property.This property corresponds to the
raster-hue-rotate-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition rasterHueRotationTransition;
Swift
var rasterHueRotationTransition: MGLTransition { get set }
-
The opacity at which the image will be drawn.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float1
. Set this property tonil
to reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterOpacity;
Swift
var rasterOpacity: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
rasterOpacity
property.This property corresponds to the
raster-opacity-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition rasterOpacityTransition;
Swift
var rasterOpacityTransition: MGLTransition { get set }
-
Increase or reduce the saturation of the image.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterSaturation;
Swift
var rasterSaturation: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
rasterSaturation
property.This property corresponds to the
raster-saturation-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition rasterSaturationTransition;
Swift
var rasterSaturationTransition: MGLTransition { get set }