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
identifierA string that uniquely identifies the source in the style to which it is added.
sourceThe 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
MGLStyleValueobject containing anNSNumberobject containing the float1. Set this property tonilto reset it to the default value.This attribute corresponds to the
raster-brightness-maxlayout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
maximumRasterBrightnessproperty.This property corresponds to the
raster-brightness-max-transitionproperty 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
MGLStyleValueobject containing anNSNumberobject containing the float0. Set this property tonilto reset it to the default value.This attribute corresponds to the
raster-brightness-minlayout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
minimumRasterBrightnessproperty.This property corresponds to the
raster-brightness-min-transitionproperty 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
MGLStyleValueobject containing anNSNumberobject containing the float0. Set this property tonilto reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
rasterContrastproperty.This property corresponds to the
raster-contrast-transitionproperty 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
MGLStyleValueobject containing anNSNumberobject containing the float300. Set this property tonilto reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
rasterFadeDurationproperty.This property corresponds to the
raster-fade-duration-transitionproperty 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
MGLStyleValueobject containing anNSNumberobject containing the float0. Set this property tonilto reset it to the default value.This attribute corresponds to the
raster-hue-rotatelayout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
rasterHueRotationproperty.This property corresponds to the
raster-hue-rotate-transitionproperty 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
MGLStyleValueobject containing anNSNumberobject containing the float1. Set this property tonilto reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
rasterOpacityproperty.This property corresponds to the
raster-opacity-transitionproperty 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
MGLStyleValueobject containing anNSNumberobject containing the float0. Set this property tonilto reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValueMGLCameraStyleFunctionwith an interpolation mode of:MGLInterpolationModeExponentialMGLInterpolationModeInterval
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
rasterSaturationproperty.This property corresponds to the
raster-saturation-transitionproperty in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition rasterSaturationTransition;Swift
var rasterSaturationTransition: MGLTransition { get set }
Install in Dash
MGLRasterStyleLayer Class Reference