Set pitch and bearing
Map options extend CameraOptions, so you can set more than the center and zoom. This example sets the pitch and bearing.
NPM module setup
npm install --save @maptiler/sdk
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
});
<!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>
body {margin: 0; padding: 0;}
#map {position: absolute; top: 0; bottom: 0; width: 100%;}
Related examples
Customize camera animations
ExamplesCustomize map camera animations using the AnimationOptions property.