Display map navigation controls
Add zoom and rotation controls to the map.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Display map navigation controls</title>
<meta property="og:description" content="Add zoom and rotation controls to the map." />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/trackasia-gl.css" />
<script src="https://unpkg.com/[email protected]/dist/trackasia-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 trackasiagl.Map({
container: 'map', // container id
style: 'https://maps.track-asia.com/styles/v1/streets.json?key=public_key',
center: {"lat":10.762622,"lng":106.660172}, // starting position
zoom: 9, // starting zoom
rollEnabled: true // Enable mouse control of camera roll angle with `Ctrl` + right-click and drag
});
// Add zoom and rotation controls to the map.
map.addControl(new trackasiagl.NavigationControl({
visualizePitch: true,
visualizeRoll: true,
showZoom: true,
showCompass: true
}));
</script>
</body>
</html>