Display map navigation controls
Add zoom and rotation controls to the map.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Add zoom and rotation controls to the map.</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.5.css" />
<script src="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.5.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
html,
body,
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
TrimbleMaps.setAPIKey('YOUR_API_KEY_HERE');
const map = new TrimbleMaps.Map({
container: 'map', // container id
style: TrimbleMaps.Common.Style.TRANSPORTATION,
center: [-74.5, 40], // starting position
zoom: 9, // starting zoom
});
// Add zoom and rotation controls to the map.
map.addControl(new TrimbleMaps.NavigationControl());
</script>
</body>
</html>
Display map navigation controls
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Add zoom and rotation controls to the map.</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.5.css" />
<script src="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.5.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
html,
body,
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
TrimbleMaps.setAPIKey('YOUR_API_KEY_HERE');
const map = new TrimbleMaps.Map({
container: 'map', // container id
style: TrimbleMaps.Common.Style.TRANSPORTATION,
center: [-74.5, 40], // starting position
zoom: 9, // starting zoom
});
// Add zoom and rotation controls to the map.
map.addControl(new TrimbleMaps.NavigationControl());
</script>
</body>
</html>