Routing is done using Trimble MAPS data for commercial vehicles. This data includes bridge heights and clearances, load limits, weight limits and allowances, one-way road designations, left-hand and dangerous turn restrictions, urban road classifications, as well as hazmat, truck-restricted, truck-designated and truck-prohibited roads.

Route

The first step in adding routes to your map is to create a new TrimbleMaps.Route object.

const myRoute = new TrimbleMaps.Route({
  routeId: 'myRoute',
  stops: [
    new TrimbleMaps.LngLat(-74.566234, 40.499440),
    new TrimbleMaps.LngLat(-74.629749, 40.261187)
  ]
});

Adding the Route to a Map

A route can be added to a map by calling the addTo method on the route object.

myRoute.addTo(myMap);

Route Options

Parameter Type Description
routeId string A unique string values used to identify a route.
stops Array An array of at least two TrimbleMaps.LngLat objects containing the locations of the stops of the route.
vehicleType enumeration Default: TrimbleMaps.Common.VehicleType.TRUCK
Restricts the route to roads that are accessible by the selected vehicle type. <ul><li>TrimbleMaps.Common.VehicleType.TRUCK - Truck</li> <li>TrimbleMaps.Common.VehicleType.LIGHT_TRUCK - Light Truck</li> <li>TrimbleMaps.Common.VehicleType.AUTOMOBILE - Automobile</li></ul>
routeType enumeration Default: TrimbleMaps.Common.RouteType.PRACTICAL
Type of route. <ul><li>TrimbleMaps.Common.RouteType.PRACTICAL - Practical</li> <li>TrimbleMaps.Common.RouteType.SHORTEST - Shortest</li> <li>TrimbleMaps.Common.RouteType.FASTEST - Fastest</li></ul>
routeOptimization enumeration Default: TrimbleMaps.Common.RouteOptimization.NONE
<ul><li>TrimbleMaps.Common.RouteOptimization.NONE - None</li> <li>TrimbleMaps.Common.RouteOptimization.OPTIMIZE_ALL_STOPS - Optimize all stops</li> <li>TrimbleMaps.Common.RouteOptimization.OPTIMIZE_INTERMEDIATE_STOPS - Optimize intermediate stops</li></ul>
tollDiscourage boolean Default: false
Generates the route by trying to avoid toll roads.
bordersOpen boolean Default: true
Indicates whether borders are open for travel.
overrideRestrict boolean Default: false
Indicates whether or not to override truck restrictions.
highwayOnly boolean Default: false
Restricts the route to only highway roads.
hazMatType enumeration Default: TrimbleMaps.Common.HazMatType.NONE
Restricts the route to roads that allow transportation of the selected hazardous material. <ul><li>TrimbleMaps.Common.HazMatType.NONE - None</li><li>TrimbleMaps.Common.HazMatType.GENERAL - General</li><li>TrimbleMaps.Common.HazMatType.CAUSTIC - Caustic</li><li>TrimbleMaps.Common.HazMatType.EXPLOSIVES - Explosives</li><li>TrimbleMaps.Common.HazMatType.FLAMMABLE - Flammable</li><li>TrimbleMaps.Common.HazMatType.INHALANTS - Inhalants</li><li>TrimbleMaps.Common.HazMatType.RADIOACTIVE - Radioactive</li></ul>
distanceUnits enumeration Default: TrimbleMaps.Common.DistanceUnit.MILES
Distance units as miles or kilometers. <ul><li>TrimbleMaps.Common.DistanceUnit.MILES - Miles</li> <li>TrimbleMaps.Common.DistanceUnit.KILOMETERS - Kilometers</li>
trkUnits enumeration Default: TrimbleMaps.Common.TruckUnit.ENGLISH
Distance units as miles or kilometers. <ul><li>TrimbleMaps.Common.TruckUnit.ENGLISH - English</li> <li>TrimbleMaps.Common.TruckUnit.METRIC - Metric</li>
trkHeight number The height of the vehicle in feet and inches or meters depending on units. Example 13’6” or 4.1148.
trkLength number The length of the vehicle in feet and inches or meters depending on units. Example 13’6” or 4.1148.
trkWidth number The width of the vehicle in feet and inches or meters depending on units. Example 13’6” or 4.1148.
trkWeight number The weight of the vehicle in pounds or kilograms depending on units.
trkAxles number Default: 5
The number of axles on the vehicle; acceptable values are 2 through 14.
inclFerryDist boolean Default: true
Indicates whether or not to include ferry distances in mileage calculations of reports.
fuelUnits enumeration Default: TrimbleMaps.Common.FuelUnit.GALLONS
Fuel units as gallons and liters. <ul><li>TrimbleMaps.Common.FuelUnit.GALLONS - Gallons</li> <li>TrimbleMaps.Common.FuelUnit.LITERS - Liters</li>
truckConfig enumeration Default: TrimbleMaps.Common.TruckConfig.NONE
The vehicle style. <ul><li>TrimbleMaps.Common.TruckConfig.NONE - Indicates that no particular vehicle style is chosen.</li><li>TrimbleMaps.Common.TruckConfig.TWENTY_EIGHT - 28’ double trailer.</li><li>TrimbleMaps.Common.TruckConfig.FORTY - 40’ straight trailer.</li><li>TrimbleMaps.Common.TruckConfig.FORTY_EIGHT - 48’ semitrailer.</li><li>TrimbleMaps.Common.TruckConfig.FIFTY_THREE - 53’ semitrailer.</li></ul>
inclTollData boolean Default: true
Indicates whether or not reports should calculate toll costs in reports.
fuelEconLoad number The fuel efficiency (distance units per fuel units) when loaded. Used for reports.
fuelEconEmpty number The fuel efficiency (distance units per fuel units) when empty. Used for reports.
costPerFuelUnit number The cost per fuel unit of fuel. Used for reports.
costGHG number The cost of greenhouse gas in lbs. per fuel unit. Used for reports.
costMaintLoad number The maintenance cost per distance unit when loaded. Used for reports.
costMaintEmpty number The maintenance cost per distance unit when empty. Used for reports.
costTimeLoad number The time cost per mile/km when loaded. Used for reports.
costTimeEmpty number The time cost per mile/km when empty. Used for reports.
tollCurrency enumeration Default: TrimbleMaps.Common.TollCurrency.USD
The toll currency. <ul><li>TrimbleMaps.Common.TollCurrency.USD - Indicates that the currency should be United States dollars.</li> <li>TrimbleMaps.Common.TollCurrency.CAD - Indicates that the currency should be Canadian dollars.</li>
exchangeRate number The change rate to convert US dollars to Canadian dollars. Used for reports.
citeInt number The cite interval to be used when generating a geotunnel report. The minimum value is 0.1. Used for reports.
region enumeration Default: TrimbleMaps.Common.Region.NA
The data region in which the route stops are located. <ul><li>TrimbleMaps.Common.Region.AF - Africa</li><li>TrimbleMaps.Common.Region.AS - Asia</li><li>TrimbleMaps.Common.Region.EU - Europe</li><li>TrimbleMaps.Common.Region.ME - Middle East</li><li>TrimbleMaps.Common.Region.NA - North America</li><li>TrimbleMaps.Common.Region.OC - Australia</li><li>TrimbleMaps.Common.Region.SA - South America</li><li>TrimbleMaps.Common.Region.WW - Worldwide</li></ul>
reportType Array Default: [TrimbleMaps.Common.ReportType.MILEAGE]
The data region in which the route stops are located. <ul><li>TrimbleMaps.Common.ReportType.MILEAGE - Mileage</li><li>TrimbleMaps.Common.ReportType.DIRECTIONS - Directions</li><li>TrimbleMaps.Common.ReportType.DETAIL - Detail</li><li>TrimbleMaps.Common.ReportType.STATE - State</li><li>TrimbleMaps.Common.ReportType.TOLL - Toll Detail</li></ul>