Skip to content

Set pitch and bearing

Initialize a map with pitch and bearing camera options.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Set pitch and bearing</title>
    <meta property="og:description" content="Initialize a map with pitch and bearing camera options." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.css' />
    <script src='https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.js'></script>
    <style>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
    </style>
</head>
<body>
<div id="map"></div>
<script>
    const map = new maplibregl.Map({
        container: 'map',
        style:
            'https://api.maptiler.com/maps/streets/style.json?key=get_your_own_OpIi9ZULNHzrESv6T2vL',
        // camera options properties
        center: [-73.5804, 45.53483],
        pitch: 60, // pitch in degrees
        bearing: -60, // bearing in degrees
        zoom: 10
    });
</script>
</body>
</html>