Skip to main content

Route Modifiers Add-on

The Route Modifiers add-on allows control of the Route Modifiers layer on the map. Route modifiers are road segments you want the routing algorithm to avoid or favor when generating a route. Route modifiers are created in the ContentTools web tool, and linked to your API key.

Example setup

View a working demo and follow the steps below to create your own.

<link href="https://maps-sdk.trimblemaps.com/addon/trimblemaps-routemodifiers-1.0.3.css" rel="stylesheet">
<!-- Route Modifiers addon reference css -->
<script src="https://maps-sdk.trimblemaps.com/addon/trimblemaps-routemodifiers-1.0.3.js"></script>
<!-- Route Modifiers addon reference js -->
TrimbleMaps.APIKey = "YOUR_ACCESS_TOKEN";

var map = (window.map = new TrimbleMaps.Map({
  container: "map",
  style: TrimbleMaps.Common.Style.TRANSPORTATION,
  zoom: 12.5,
  center: [-77.01866, 38.888],
  region: TrimbleMaps.Common.Region.NA,
}));

// setup the Route Modifiers control
const modifierOptions = {
  isVisible: true,
};
const modifiersControl = new TrimbleMapsControl.RouteModifiers(modifierOptions);

// add control to map
map.addControl(modifiersControl, "top-right");

// once the map is loaded, load the AF Sets
myMap.once("load", () => {
  console.log("AF SETS from the ControlPanel: ", modifiers.getAFSets());
});

Customization Options

Parameter Type/Values Description
isVisible
Boolean
Specifies if the layer is should be displayed. Default true
Last updated September 15, 2023.