You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The animationstyle when the camara updates. One of; flyTo, easeTo, moveTo
defaultSettings
shape
none
false
Default view settings applied on camera
centerCoordinate
array
none
false
Center coordinate on map [lng, lat]
heading
number
none
false
Heading on map
pitch
number
none
false
Pitch on map
bounds
shape
none
false
Represents a rectangle in geographical coordinates marking the visible area of the map.
ne
array
none
true
North east coordinate of bound
sw
array
none
true
South west coordinate of bound
paddingLeft
number
none
false
Left camera padding for bounds
paddingRight
number
none
false
Right camera padding for bounds
paddingTop
number
none
false
Top camera padding for bounds
paddingBottom
number
none
false
Bottom camera padding for bounds
onUserTrackingModeChange
func
none
false
Callback that is triggered on user tracking mode changes
zoomLevel
number
none
false
Zoom level of the map
centerCoordinate
array
none
false
Center coordinate on map [lng, lat]
heading
number
none
false
Heading on map
pitch
number
none
false
Pitch on map
bounds
shape
none
false
Represents a rectangle in geographical coordinates marking the visible area of the map.
ne
array
none
true
North east coordinate of bound
sw
array
none
true
South west coordinate of bound
paddingLeft
number
none
false
Left camera padding for bounds
paddingRight
number
none
false
Right camera padding for bounds
paddingTop
number
none
false
Top camera padding for bounds
paddingBottom
number
none
false
Bottom camera padding for bounds
onUserTrackingModeChange
func
none
false
Callback that is triggered on user tracking mode changes
zoomLevel
number
none
false
Zoom level of the map
minZoomLevel
number
none
false
The minimun zoom level of the map
maxZoomLevel
number
none
false
The maximun zoom level of the map
maxBounds
shape
none
false
Restrict map panning so that the center is within these bounds
ne
array
none
true
northEastCoordinates - North east coordinate of bound
sw
array
none
true
southWestCoordinates - South west coordinate of bound
followUserLocation
bool
none
false
Should the map orientation follow the user's.
followUserMode
enum
none
false
The mode used to track the user location on the map. One of; "normal", "compass", "course". Each mode string is also available as a member on the MapboxGL.UserTrackingModes object. Follow (normal), FollowWithHeading (compass), FollowWithCourse (course). NOTE: followUserLocation must be set to true for any of the modes to take effect. Example
followZoomLevel
number
none
false
The zoomLevel on map while followUserLocation is set to true
followPitch
number
none
false
The pitch on map while followUserLocation is set to true
followHeading
number
none
false
The heading on map while followUserLocation is set to true
triggerKey
any
none
false
Manually update the camera - helpful for when props did not update, however you still want the camera to move
this.camera.fitBounds([lng,lat],[lng,lat])this.camera.fitBounds([lng,lat],[lng,lat],20,1000)// padding for all sidesthis.camera.fitBounds([lng,lat],[lng,lat],[verticalPadding,horizontalPadding],1000)this.camera.fitBounds([lng,lat],[lng,lat],[top,right,bottom,left],1000)
Map camera will move to new coordinate at the same zoom level
arguments
Name
Type
Required
Description
coordinates
Array
Yes
Coordinates that map camera will move too
animationDuration
Number
No
Duration of camera animation
this.camera.moveTo([lng,lat],200)// eases camera to new location based on durationthis.camera.moveTo([lng,lat])// snaps camera to new location without any easing
zoomTo(zoomLevel[, animationDuration])
Map camera will zoom to specified level
arguments
Name
Type
Required
Description
zoomLevel
Number
Yes
Zoom level that the map camera will animate too
animationDuration
Number
No
Duration of camera animation
this.camera.zoomTo(16)this.camera.zoomTo(16,100)
setCamera(config)
Map camera will perform updates based on provided config. Advanced use only!