Truck Restrictions (Europe)
The truck restrictions layer allows you to display truck restrictions on the map. By adding theTruckRestrictionClickControl, a pop-up message appears after clicking on a restriction. TruckRestrictionFilterControl allows you to filter restriction categories by general, dimension and hazmat.
Requires Trimble Maps v3.1.0 or later.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<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; }
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
TrimbleMaps.setAPIKey('YOUR_API_KEY_HERE');
const myMap = new TrimbleMaps.Map({
container: 'map', // container id
style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id
center: [-3.6944658469219442, 40.41492846161693], // Paris
region: TrimbleMaps.Common.Region.EU,
zoom: 15 // starting zoom
});
const truckRestriction = new TrimbleMaps.TruckRestriction();
const ctrlClick = new TrimbleMaps.TruckRestrictionClickControl();
myMap.addControl(ctrlClick);
ctrlFilter = new TrimbleMaps.TruckRestrictionFilterControl({
isVisible: true,
category: "All",
vehicleOptions: {
trkWeight: 13000,
trkWidth: 70,
trkLength: 40,
vehicleType: TrimbleMaps.Common.VehicleType.TRUCK
}
});
myMap.addControl(ctrlFilter, 'top-left');
myMap.on('load', function() {
truckRestriction.addTo(myMap);
});
myMap.on('truckrestriction', () => {
truckRestriction.setVisibility(true);
ctrlFilter.filter();
})
</script>
</body>
</html>
Truck Restrictions (Europe)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<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; }
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
TrimbleMaps.setAPIKey('YOUR_API_KEY_HERE');
const myMap = new TrimbleMaps.Map({
container: 'map', // container id
style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id
center: [-3.6944658469219442, 40.41492846161693], // Paris
region: TrimbleMaps.Common.Region.EU,
zoom: 15 // starting zoom
});
const truckRestriction = new TrimbleMaps.TruckRestriction();
const ctrlClick = new TrimbleMaps.TruckRestrictionClickControl();
myMap.addControl(ctrlClick);
ctrlFilter = new TrimbleMaps.TruckRestrictionFilterControl({
isVisible: true,
category: "All",
vehicleOptions: {
trkWeight: 13000,
trkWidth: 70,
trkLength: 40,
vehicleType: TrimbleMaps.Common.VehicleType.TRUCK
}
});
myMap.addControl(ctrlFilter, 'top-left');
myMap.on('load', function() {
truckRestriction.addTo(myMap);
});
myMap.on('truckrestriction', () => {
truckRestriction.setVisibility(true);
ctrlFilter.filter();
})
</script>
</body>
</html>