Mapbox spec: model
import { ModelLayer } from '@rnmapbox/maps';
ModelLayerModelLayer is a style layer that renders one or more stroked polylines on the map.
stringrequired A string that uniquely identifies the source in the style to which it is added.
booleanThe id refers to an existing layer in the style. Does not create a new layer.
stringThe 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
stringIdentifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
stringInserts a layer above aboveLayerID.
stringInserts a layer below belowLayerID
numberInserts a layer at a specified index
FilterExpressionFilter only the features in the source layer that satisfy a condition that you define
numberThe minimum zoom level at which the layer gets parsed and appears.
numberThe maximum zoom level at which the layer gets parsed and appears.
'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
ModelLayerStylePropsCustomizable style attributes
- visibility
- modelId
- modelAllowDensityReduction
- modelOpacity
- modelRotation
- modelScale
- modelTranslation
- modelColor
- modelColorMixIntensity
- modelType
- modelCastShadows
- modelReceiveShadows
- modelAmbientOcclusionIntensity
- modelEmissiveStrength
- modelRoughness
- modelHeightBasedEmissiveStrengthMultiplier
- modelCutoffFadeRange
- modelElevationReference
Name: visibility
Mapbox spec: visibility
Whether this layer is displayed.
enum
visible
visible - The layer is shown.
none - The layer is not shown.
Parameters: ``
Name: modelId
Mapbox spec: model-id
Model to render. It can be either a string referencing an element to the models root property or an internal or external URL
string
empty string
Parameters: zoom, feature
Name: modelAllowDensityReduction
Mapbox spec: model-allow-density-reduction
If true, the models will be reduced in density based on the zoom level. This is useful for large datasets that may be slow to render.
boolean
true
Name: modelOpacity
Mapbox spec: model-opacity
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.
number
1
0
1
Parameters: feature, feature-state, zoom
Name: modelOpacityTransition
The transition affecting any changes to this layer’s modelOpacity property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelRotation
Mapbox spec: model-rotation
The rotation of the model in euler angles [lon, lat, z].
array<number>
[0,0,0]
degrees
Parameters: feature, feature-state, zoom
Name: modelRotationTransition
The transition affecting any changes to this layer’s modelRotation property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelScale
Mapbox spec: model-scale
The scale of the model. Expressions that are zoomDependent are not supported if using GeoJSON or vector tile as the model layer source.
array<number>
[1,1,1]
Parameters: feature, feature-state, zoom
Name: modelScaleTransition
The transition affecting any changes to this layer’s modelScale property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelTranslation
Mapbox spec: model-translation
The translation of the model in meters in form of [longitudal, latitudal, altitude] offsets.
array<number>
[0,0,0]
Parameters: feature, feature-state, zoom
Name: modelTranslationTransition
The transition affecting any changes to this layer’s modelTranslation property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelColor
Mapbox spec: model-color
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.
color
#ffffff
Parameters: feature, feature-state, measure-light, zoom
Name: modelColorTransition
The transition affecting any changes to this layer’s modelColor property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelColorMixIntensity
Mapbox spec: model-color-mix-intensity
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.
number
0
0
1
Parameters: feature, feature-state, measure-light
Name: modelColorMixIntensityTransition
The transition affecting any changes to this layer’s modelColorMixIntensity property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelType
Mapbox spec: model-type
Defines rendering behavior of model in respect to other 3D scene objects.
enum
common-3d
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.
Name: modelCastShadows
Mapbox spec: model-cast-shadows
Enable/Disable shadow casting for this layer
boolean
true
Name: modelReceiveShadows
Mapbox spec: model-receive-shadows
Enable/Disable shadow receiving for this layer
boolean
true
Name: modelAmbientOcclusionIntensity
Mapbox spec: model-ambient-occlusion-intensity
Intensity of the ambient occlusion if present in the 3D model.
number
1
0
1
Parameters: zoom
Name: modelAmbientOcclusionIntensityTransition
The transition affecting any changes to this layer’s modelAmbientOcclusionIntensity property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelEmissiveStrength
Mapbox spec: model-emissive-strength
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.
number
0
intensity
0
5
Parameters: feature, feature-state, measure-light
Name: modelEmissiveStrengthTransition
The transition affecting any changes to this layer’s modelEmissiveStrength property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelRoughness
Mapbox spec: model-roughness
Material roughness. Material is fully smooth for value 0, and fully rough for value 1. Affects only layers using batchedModel source.
number
1
0
1
Parameters: feature, feature-state
Name: modelRoughnessTransition
The transition affecting any changes to this layer’s modelRoughness property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelHeightBasedEmissiveStrengthMultiplier
Mapbox spec: model-height-based-emissive-strength-multiplier
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)).
array<number>
[1,1,1,1,0]
Parameters: feature, feature-state, measure-light
Name: modelHeightBasedEmissiveStrengthMultiplierTransition
The transition affecting any changes to this layer’s modelHeightBasedEmissiveStrengthMultiplier property.
{ duration, delay }
milliseconds
{duration: 300, delay: 0}
Name: modelCutoffFadeRange
Mapbox spec: model-cutoff-fade-range
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.
number
0
0
1
Parameters: ``
Name: modelElevationReference
Mapbox spec: model-elevation-reference
Selects the base of the model. Some modes might require precomputed elevation data in the tileset. When using vector tiled source as the model layer source and hdRoadMarkup elevation reference, this property acts as layout property and elevation is evaluated only in tile loading time.
enum
ground
sea - Elevated rendering is enabled. Use this mode to elevate models relative to the sea level.
ground - Elevated rendering is enabled. Use this mode to elevate models relative to the ground's height below them.
hd-road-markup - Elevated rendering is enabled. Use this mode to describe additive and stackable features that should exist only on top of road polygons.
Parameters: ``