Truck Restrictions

The truck restrictions layer allows you to display truck restrictions on your map. The controls listed below can be used to interact with the Truck Restrictions layer.

Truck Restrictions Layer

Create a TruckRestriction object and add it to the map.

const truckRestriction = new TrimbleMaps.TruckRestriction();
myMap.on('load', function() {
    truckRestriction.addTo(myMap);
});

Once the TruckRestriction layer is loaded and ready to use, make it visible.

myMap.on('truckrestriction', () => {
    truckRestriction.setVisibility(true);
})

Get the visibility of the truck restriction layer.

const restrictionsVisible = truckRestriction.isVisible();

Toggle the visibility of the truck restrictions layer.

truckRestriction.toggleVisibility();

Truck Restrictions Click Control

The click control makes the truck restrictions on the map clickable. A popup with restriction details is shown when the restriction is clicked.

Truck Restrictions Click Control

var ctrl = new TrimbleMaps.TruckRestrictionClickControl();
myMap.addControl(ctrl);

Truck Restrictions Filter Control

The Filter control allows user to filter the restriction based on category. Be sure to call the Filter() function once the TruckRestrictions are loaded.

Truck Restrictions Filter Control

var ctrlFilter = new TrimbleMaps.TruckRestrictionFilterControl();
myMap.addControl(ctrlFilter);
myMap.on('truckrestriction', () => {
    truckRestriction.setVisibility(true);
    ctrlFilter.Filter()
})

Last updated October 6, 2021.