<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.4.0.css" />
<script src="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.4.0.js"></script>
<style>
body { margin: 0; padding: 0; }
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
TrimbleMaps.APIKey = 'YOUR_API_KEY_HERE';
const map = new TrimbleMaps.Map({
container: 'map', // container id
style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id
center: [-74.011934, 40.708016], // starting position
zoom: 16 // starting zoom
});
const truckRestriction = new TrimbleMaps.TruckRestriction();
const ctrlClick = new TrimbleMaps.TruckRestrictionClickControl();
map.addControl(ctrlClick);
const ctrlFilter = new TrimbleMaps.TruckRestrictionFilterControl({ isVisible: true, category: 'All' });
map.addControl(ctrlFilter, 'top-left');
map.on('load', function() {
truckRestriction.addTo(map);
});
map.on('truckrestriction', () => {
truckRestriction.setVisibility(true);
ctrlFilter.filter();
})
</script>
</body>
</html>