When to use Route Templates

If you find yourself in a situation where you have more than 1 routes with identical constraints then you may find using routeTemplates to be more efficient, since you can define the constraints of all identical routes in a single object.

A routeTemplates array is collection of routeTemplate objects that can be used to consolidate multiple route objects into a single routeTemplates object.

{
  "routeScenario": {
    "routeTemplates": [
      {routeTemplate 1},
      {routeTemplate 2},
      ...
      {routeTemplate n}
    ],
    ...
  }
}

Here's an anatomy of routeTemplate object:

{
  "name": "RouteTemplate 1",
  "routeLimit": 3,
  "constraints": {
    "capacity": 300,
    "startTime": "16:00",
    "endTime": "22:00",
    "startLocations": [
      {
        "address": "310 Alden Rd Markham, ON L3R 4C1",
        "latitude": 43.83323380866067,
        "longitude": -79.33590708604284
      }
    ],
    "endLocations": [
      {
        "address": "310 Alden Rd Markham, ON L3R 4C1",
        "latitude": 43.83323380866067,
        "longitude": -79.33590708604284
      }
    ],
  }
}

The only difference between a route object and a routeTemplate object is the specification of routeLimit property in the routeTemplate. Specifying a routeLimit limit informs Routific how many route can be created using the template. If left empty, Routific will create as many routes as needed to fully serve all of the stops in the optimization request.