Skip to main content

RasterLayer

Mapbox spec: raster

import { RasterLayer } from '@rnmapbox/maps';

RasterLayer

props​

id​

string

required A string that uniquely identifies the source in the style to which it is added.

existing​

boolean

The id refers to an existing layer in the style. Does not create a new layer.

sourceID​

string

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. Inferred from parent source only if the layer is a direct child to it.

defaults to: Mapbox.StyleSource.DefaultSourceID

sourceLayerID​

string

Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.

aboveLayerID​

string

Inserts a layer above aboveLayerID.

belowLayerID​

string

Inserts a layer below belowLayerID

layerIndex​

number

Inserts a layer at a specified index

filter​

FilterExpression

Filter only the features in the source layer that satisfy a condition that you define

minZoomLevel​

number

The minimum zoom level at which the layer gets parsed and appears.

maxZoomLevel​

number

The maximum zoom level at which the layer gets parsed and appears.

slot​

'bottom' | 'middle' | 'top'

The slot this layer is assigned to. If specified, and a slot with that name exists, it will be placed at that position in the layer order.

v11 only

style​

RasterLayerStyleProps

required Customizable style attributes

styles​


visibility​

Name: visibility

Mapbox spec: visibility

Description​

Whether this layer is displayed.

Type​

enum

Default Value​

visible

Supported Values​

visible - The layer is shown.
none - The layer is not shown.

Expression​

Parameters: ``


rasterOpacity​

Name: rasterOpacity

Mapbox spec: raster-opacity

Description​

The opacity at which the image will be drawn.

Type​

number

Default Value​

1

Minimum​

0

Maximum​

1

Expression​

Parameters: zoom


rasterOpacityTransition​

Name: rasterOpacityTransition

Description​

The transition affecting any changes to this layer’s rasterOpacity property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterColor​

Name: rasterColor

Mapbox spec: raster-color

Description​

Defines the color ramp used to colorize a raster layer, parameterized by the ["rasterValue"] expression and evaluated over the range specified by rasterColorRange. Raster values are spaced evenly across the range by default.

Type​

color

Expression​

Parameters: raster-value


rasterColorMix​

Name: rasterColorMix

Mapbox spec: raster-color-mix

Description​

When rasterColor is active, specifies how the raster value is computed from a nonrasterarray source's channels, using the equation mix.r * src.r + mix.g * src.g + mix.b * src.b + mix.a. The first three components weight the source's red, green, and blue channels; the fourth is a constant offset and is not multiplied by source alpha. Source alpha is carried through and applied as opacity to the colorized result. The default corresponds to RGB luminosity. rasterarray sources ignore this property, as their raster value is decoded directly from the source data.

Type​

array<number>

Default Value​

[0.2126,0.7152,0.0722,0]

Requires​

rasterColor

Expression​

Parameters: zoom


rasterColorMixTransition​

Name: rasterColorMixTransition

Description​

The transition affecting any changes to this layer’s rasterColorMix property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterColorRange​

Name: rasterColorRange

Mapbox spec: raster-color-range

Description​

When rasterColor is active, specifies the range of raster values mapped onto the color ramp, from the start of the ramp (low bound) to its end (high bound). For rasterarray sources the raster value is the decoded source data in the source's own units, and the source's stated data range is used when this property is unspecified. For other raster sources the raster value is computed from the source's channels via rasterColorMix. Defaults to [0, 1] when no range is otherwise available.

Type​

array<number>

Requires​

rasterColor

Expression​

Parameters: zoom


rasterColorRangeTransition​

Name: rasterColorRangeTransition

Description​

The transition affecting any changes to this layer’s rasterColorRange property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterColorScale​

Name: rasterColorScale

Mapbox spec: raster-color-scale

Description​

When rasterColor is active, specifies how raster values are distributed across the color ramp over the range specified by rasterColorRange.

Type​

enum

Default Value​

linear

Supported Values​

linear - Raster values are spaced evenly across the color ramp.
log - Raster values are spaced logarithmically, giving more of the color ramp to smaller values. Useful for data concentrated near the low end of a wide range.

Requires​

rasterColor

Expression​

Parameters: ``


rasterHueRotate​

Name: rasterHueRotate

Mapbox spec: raster-hue-rotate

Description​

Rotates hues around the color wheel.

Type​

number

Default Value​

0

Units​

degrees

Expression​

Parameters: zoom


rasterHueRotateTransition​

Name: rasterHueRotateTransition

Description​

The transition affecting any changes to this layer’s rasterHueRotate property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterBrightnessMin​

Name: rasterBrightnessMin

Mapbox spec: raster-brightness-min

Description​

Increase or reduce the brightness of the image. The value is the minimum brightness.

Type​

number

Default Value​

0

Minimum​

0

Maximum​

1

Expression​

Parameters: zoom


rasterBrightnessMinTransition​

Name: rasterBrightnessMinTransition

Description​

The transition affecting any changes to this layer’s rasterBrightnessMin property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterBrightnessMax​

Name: rasterBrightnessMax

Mapbox spec: raster-brightness-max

Description​

Increase or reduce the brightness of the image. The value is the maximum brightness.

Type​

number

Default Value​

1

Minimum​

0

Maximum​

1

Expression​

Parameters: zoom


rasterBrightnessMaxTransition​

Name: rasterBrightnessMaxTransition

Description​

The transition affecting any changes to this layer’s rasterBrightnessMax property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterSaturation​

Name: rasterSaturation

Mapbox spec: raster-saturation

Description​

Increase or reduce the saturation of the image.

Type​

number

Default Value​

0

Minimum​

-1

Maximum​

1

Expression​

Parameters: zoom


rasterSaturationTransition​

Name: rasterSaturationTransition

Description​

The transition affecting any changes to this layer’s rasterSaturation property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterContrast​

Name: rasterContrast

Mapbox spec: raster-contrast

Description​

Increase or reduce the contrast of the image.

Type​

number

Default Value​

0

Minimum​

-1

Maximum​

1

Expression​

Parameters: zoom


rasterContrastTransition​

Name: rasterContrastTransition

Description​

The transition affecting any changes to this layer’s rasterContrast property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterResampling​

Name: rasterResampling

Mapbox spec: raster-resampling

Description​

The resampling/interpolation method to use for overscaling, also known as texture magnification filter

Type​

enum

Default Value​

linear

Supported Values​

linear - (Bi)linear filtering interpolates pixel values using the weighted average of the four closest original source pixels creating a smooth but blurry look when overscaled
nearest - Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled

Expression​

Parameters: zoom


rasterFadeDuration​

Name: rasterFadeDuration

Mapbox spec: raster-fade-duration

Description​

Fade duration when a new tile is added.

Type​

number

Default Value​

300

Units​

milliseconds

Minimum​

0

Expression​

Parameters: zoom


rasterEmissiveStrength​

Name: rasterEmissiveStrength

Mapbox spec: raster-emissive-strength

Description​

Controls the intensity of light emitted on the source features.

Type​

number

Default Value​

0

Units​

intensity

Minimum​

0

Requires​

lights

Expression​

Parameters: zoom, measure-light


rasterEmissiveStrengthTransition​

Name: rasterEmissiveStrengthTransition

Description​

The transition affecting any changes to this layer’s rasterEmissiveStrength property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}


rasterArrayBand​

Name: rasterArrayBand

Mapbox spec: raster-array-band

Description​

Displayed band of raster array source layer. Defaults to the first band if not set.

Type​

string


rasterElevation​

Name: rasterElevation

Mapbox spec: raster-elevation

Description​

Defines an uniform elevation from the base specified in rasterElevationReference.

Type​

number

Default Value​

0

Units​

meters

Minimum​

0

Expression​

Parameters: zoom


rasterElevationTransition​

Name: rasterElevationTransition

Description​

The transition affecting any changes to this layer’s rasterElevation property.

Type​

{ duration, delay }

Units​

milliseconds

Default Value​

{duration: 300, delay: 0}