Skip to content

CameraOptions

CameraOptions: CenterZoomBearing & object

Options common to Map#jumpTo, Map#easeTo, and Map#flyTo, controlling the desired location, zoom, bearing, and pitch of the camera. All properties are optional, and when a property is omitted, the current camera value for that property will remain unchanged.

Type declaration

around?

optional around: LngLatLike

If zoom is specified, around determines the point around which the zoom is centered.

pitch?

optional pitch: number

The desired pitch in degrees. The pitch is the angle towards the horizon measured in degrees with a range between 0 and 60 degrees. For example, pitch: 0 provides the appearance of looking straight down at the map, while pitch: 60 tilts the user's perspective towards the horizon. Increasing the pitch value is often used to display 3D objects.

Example

Set the map's initial perspective with CameraOptions

let map = new Map({
  container: 'map',
  style: 'https://demotiles.maplibre.org/style.json',
  center: [-73.5804, 45.53483],
  pitch: 60,
  bearing: -60,
  zoom: 10
});

See

Defined in

src/ui/camera.ts:57