Skip to content

CameraOptions

CameraOptions: CenterZoomBearing & object

Defined in: src/ui/camera.ts:54

Options common to Map#jumpTo, Map#easeTo, and Map#flyTo, controlling the desired location, zoom, bearing, pitch, and roll 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

elevation?

optional elevation: number

The elevation of the center point in meters above sea level.

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.

roll?

optional roll: number

The desired roll in degrees. The roll is the angle about the camera boresight.

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