---
title: "Set pitch and bearing | JavaScript maps SDK"
description: "Initialize a map with pitch and bearing."
---

# Set pitch and bearing

Map options extend [`CameraOptions`](https://docs.maptiler.com/sdk-js/api/properties/#cameraoptions), so you can set more than the center and zoom. This example sets the pitch and bearing.

### NPM module setup

```bash
npm install --save @maptiler/sdk
```

#### main.js

```js
import { Map, MapStyle, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
    container: 'map',
    style: MapStyle.STREETS, 
    // camera options properties
    center: [-73.5804, 45.53483],
    pitch: 60, // pitch in degrees
    bearing: -60, // bearing in degrees
    zoom: 10
});
```

#### index.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="robots" content="noindex">
  <title>Set pitch and bearing | NPM example</title>
  <link rel="stylesheet" href="./style.css">
</head>
<body>
  <div id="map"></div>
  <script type="module" src="./main.js"></script>
</body>
</html>
```

#### style.css

```css
body {margin: 0; padding: 0;}
#map {position: absolute; top: 0; bottom: 0; width: 100%;}
```

### Basic JavaScript setup

```html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Set pitch and bearing</title>
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v4.2.0/maptiler-sdk.umd.min.js"></script>
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v4.2.0/maptiler-sdk.css" rel="stylesheet" />
<style>
  body {margin: 0; padding: 0;}
  #map {position: absolute; top: 0; bottom: 0; width: 100%;}
</style>
</head>
<body>
<div id="map"></div>
<script>
    maptilersdk.config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
    const map = new maptilersdk.Map({
        container: 'map',
        style: maptilersdk.MapStyle.STREETS, 
        // camera options properties
        center: [-73.5804, 45.53483],
        pitch: 60, // pitch in degrees
        bearing: -60, // bearing in degrees
        zoom: 10
    });
</script>
</body>
</html>
```

## Related examples

### [3D terrain map](https://docs.maptiler.com/sdk-js/examples/3d-map/)

Tutorials

Create and display 3D terrain maps on web pages.

### [Customize camera animations](https://docs.maptiler.com/sdk-js/examples/camera-animation/)

Examples

Customize map camera animations using the AnimationOptions property.

### [Fly to a location](https://docs.maptiler.com/sdk-js/examples/flyto/)

Examples

Smoothly interpolate between locations using the flyTo animation.

### [Toggle interactions](https://docs.maptiler.com/sdk-js/examples/toggle-interaction-handlers/)

Examples

Enable or disable specific user interaction handlers on maps.
