ModelLayer
Mapbox spec: model
import { ModelLayer } from '@rnmapbox/maps';
ModelLayer
ModelLayer is a style layer that renders one or more stroked polylines on the map.
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
ModelLayerStyleProps
Customizable style attributes
styles
-
visibility
-
modelId
-
modelOpacity
-
modelRotation
-
modelScale
-
modelTranslation
-
modelColor
-
modelColorMixIntensity
-
modelType
-
modelCastShadows
-
modelReceiveShadows
-
modelAmbientOcclusionIntensity
-
modelEmissiveStrength
-
modelRoughness
-
modelHeightBasedEmissiveStrengthMultiplier
-
modelCutoffFadeRange
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: ``
modelId
Name: modelId
Mapbox spec: model-id
Description
Model to render. It can be either a string referencing an element to the models root property or an internal or external URL
Type
string
Default Value
empty string
Expression
Parameters: zoom, feature
modelOpacity
Name: modelOpacity
Mapbox spec: model-opacity
Description
The opacity of the model layer. Except for zoom, expressions that are dataDriven are not supported if using GeoJSON or vector tile as the model layer source.
Type
number
Default Value
1
Minimum
0
Maximum
1
Expression
Parameters: feature, feature-state, zoom
modelOpacityTransition
Name: modelOpacityTransition
Description
The transition affecting any changes to this layer’s modelOpacity property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelRotation
Name: modelRotation
Mapbox spec: model-rotation
Description
The rotation of the model in euler angles [lon, lat, z].
Type
array<number>
Default Value
[0,0,0]
Units
degrees
Expression
Parameters: feature, feature-state, zoom
modelRotationTransition
Name: modelRotationTransition
Description
The transition affecting any changes to this layer’s modelRotation property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelScale
Name: modelScale
Mapbox spec: model-scale
Description
The scale of the model. Expressions that are zoomDependent are not supported if using GeoJSON or vector tile as the model layer source.
Type
array<number>
Default Value
[1,1,1]
Expression
Parameters: feature, feature-state, zoom
modelScaleTransition
Name: modelScaleTransition
Description
The transition affecting any changes to this layer’s modelScale property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelTranslation
Name: modelTranslation
Mapbox spec: model-translation
Description
The translation of the model in meters in form of [longitudal, latitudal, altitude] offsets.
Type
array<number>
Default Value
[0,0,0]
Expression
Parameters: feature, feature-state, zoom
modelTranslationTransition
Name: modelTranslationTransition
Description
The transition affecting any changes to this layer’s modelTranslation property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelColor
Name: modelColor
Mapbox spec: model-color
Description
The tint color of the model layer. modelColorMixIntensity (defaults to 0) defines tint(mix) intensity this means that, this color is not used unless modelColorMixIntensity gets value greater than 0. Expressions that depend on measureLight are not supported when using GeoJSON or vector tile as the model layer source.
Type
color
Default Value
#ffffff
Expression
Parameters: feature, feature-state, measure-light, zoom
modelColorTransition
Name: modelColorTransition
Description
The transition affecting any changes to this layer’s modelColor property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelColorMixIntensity
Name: modelColorMixIntensity
Mapbox spec: model-color-mix-intensity
Description
Intensity of modelColor (on a scale from 0 to 1) in color mix with original 3D model's colors. Higher number will present a higher modelColor contribution in mix. Expressions that depend on measureLight are not supported when using GeoJSON or vector tile as the model layer source.
Type
number
Default Value
0
Minimum
0
Maximum
1
Expression
Parameters: feature, feature-state, measure-light
modelColorMixIntensityTransition
Name: modelColorMixIntensityTransition
Description
The transition affecting any changes to this layer’s modelColorMixIntensity property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelType
Name: modelType
Mapbox spec: model-type
Description
Defines rendering behavior of model in respect to other 3D scene objects.
Type
enum
Default Value
common-3d
Supported Values
common-3d - Integrated to 3D scene, using depth testing, along with terrain, fill-extrusions and custom layer.
location-indicator - Displayed over other 3D content, occluded by terrain.
modelCastShadows
Name: modelCastShadows
Mapbox spec: model-cast-shadows
Description
Enable/Disable shadow casting for this layer
Type
boolean
Default Value
true
modelReceiveShadows
Name: modelReceiveShadows
Mapbox spec: model-receive-shadows
Description
Enable/Disable shadow receiving for this layer
Type
boolean
Default Value
true
modelAmbientOcclusionIntensity
Name: modelAmbientOcclusionIntensity
Mapbox spec: model-ambient-occlusion-intensity
Description
Intensity of the ambient occlusion if present in the 3D model.
Type
number
Default Value
1
Minimum
0
Maximum
1
Expression
Parameters: zoom
modelAmbientOcclusionIntensityTransition
Name: modelAmbientOcclusionIntensityTransition
Description
The transition affecting any changes to this layer’s modelAmbientOcclusionIntensity property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelEmissiveStrength
Name: modelEmissiveStrength
Mapbox spec: model-emissive-strength
Description
Strength of the emission. There is no emission for value 0. For value 1.0, only emissive component (no shading) is displayed and values above 1.0 produce light contribution to surrounding area, for some of the parts (e.g. doors). Expressions that depend on measureLight are only supported as a global layer value (and not for each feature) when using GeoJSON or vector tile as the model layer source.
Type
number
Default Value
0
Units
intensity
Minimum
0
Maximum
5
Expression
Parameters: feature, feature-state, measure-light
modelEmissiveStrengthTransition
Name: modelEmissiveStrengthTransition
Description
The transition affecting any changes to this layer’s modelEmissiveStrength property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelRoughness
Name: modelRoughness
Mapbox spec: model-roughness
Description
Material roughness. Material is fully smooth for value 0, and fully rough for value 1. Affects only layers using batchedModel source.
Type
number
Default Value
1
Minimum
0
Maximum
1
Expression
Parameters: feature, feature-state
modelRoughnessTransition
Name: modelRoughnessTransition
Description
The transition affecting any changes to this layer’s modelRoughness property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelHeightBasedEmissiveStrengthMultiplier
Name: modelHeightBasedEmissiveStrengthMultiplier
Mapbox spec: model-height-based-emissive-strength-multiplier
Description
Emissive strength multiplier along model height (gradient begin, gradient end, value at begin, value at end, gradient curve power (logarithmic scale, curve power = pow(10, val)).
Type
array<number>
Default Value
[1,1,1,1,0]
Expression
Parameters: feature, feature-state, measure-light
modelHeightBasedEmissiveStrengthMultiplierTransition
Name: modelHeightBasedEmissiveStrengthMultiplierTransition
Description
The transition affecting any changes to this layer’s modelHeightBasedEmissiveStrengthMultiplier property.
Type
{ duration, delay }
Units
milliseconds
Default Value
{duration: 300, delay: 0}
modelCutoffFadeRange
Name: modelCutoffFadeRange
Mapbox spec: model-cutoff-fade-range
Description
This parameter defines the range for the fadeOut effect before an automatic content cutoff on pitched map views. The automatic cutoff range is calculated according to the minimum required zoom level of the source and layer. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.
Type
number
Default Value
0
Minimum
0
Maximum
1
Expression
Parameters: ``