Route Optimization with TollGuru API: Fastest, Cheapest, and EV-friendly Journeys

Last updated on Jan 11, 2024 · 3 minutes

Route Optimization with TollGuru API: Fastest, Cheapest, and EV-friendly Journeys

The future of mobility is digital, and the key to this future lies in harnessing the power of data. TollGuru’s API serves as a powerful tool to unlock this potential, providing a wealth of information for route optimization. This blog will explore how to use TollGuru’s API for finding the fastest and cheapest routes and for planning efficient routes for electric vehicles (EVs).

Discovering the Fastest and Cheapest Routes

When planning a journey, two crucial factors often come into play: time and cost. With the TollGuru API, developers can build solutions that provide users with the fastest and cheapest routes for their journeys.

Fastest Route

TollGuru’s API returns a diffs object in the response body that provides insights into the fastest and cheapest routes. The diffs object contains data in the format {“cheapest”:”x.xx”,”fastest”:y}, where x.xx is the additional cost to take the fastest route, and y is the additional time in minutes to take the cheapest route.
   1  "diffs": {
   2     "cheapest": 0,
   3     "fastest": 2
   4  }
In this example, the value of “fastest” is 0, indicating that this route is the fastest. If the value was 2, it would mean the route is 2 minutes slower than the fastest route.

Cheapest Route

Similarly, if “cheapest” is 0, it indicates that the route is the cheapest. If it was 2, it would mean the route is $2 more expensive than the cheapest route.
   1  "diffs": {
   2     "cheapest": 1.35,
   3     "fastest": 0
   4  }
The API also provides cost breakdowns for various payment methods in the costs object, including fuel, tag, cash, licensePlate, creditCard, and prepaidCard. By comparing these values, developers can help users find the most cost-effective route based on their preferred payment method.
   1  "costs": {
   2     "tagAndCash": 0.4,
   3     "minimumTollCost": 0.4,
   4     "fuel": 2.3,
   5     "tag": 0.4,
   6     "cash": null,
   7     "licensePlate": 0.68,
   8     "prepaidCard": 0.4
   9  }

EV Route Planning with TollGuru API

The rise of electric vehicles (EVs) has brought new challenges to route planning. Not only do you need to find the fastest and most cost-effective route, but you also need to locate charging points along the way. The TollGuru API provides a chargingPoints field specifically for this purpose. Each object within the chargingPoints array contains detailed information about a specific EV charging station along the route. This includes the station’s name, address, contact phone number, geographic coordinates, connector type, power feed types, pricing structure, facility type, access times, and more.

Here’s an example of a chargingPoints list:

   1  "chargingPoints": [
   2    {
   3     "id": 85980,
   4     "evStation": {
   5         "name": "Clay Cooley Nissan",
   6         "address": "4707 Lyndon B Johnson Fwy, Farmers Branch, TX, 75244, US",
   7         "contact": {
   8             "phone": "972-450-2400"
   9         },
  10         "position": {
  11             "point": {
  12                 "type": "Feature",
  13                 "properties": {},
  14                 "geometry": {
  15                     "type": "Point",
  16                     "coordinates": [
  17                         -96.828116,
  18                         32.926739
  19                     ]
  20                 }
  21             }
  22         },
  23         "brand": "Non-Networked",
  24         "connectorType": "J1772",
  25         "powerFeedTypes": [
  26             {
  27                 "id": 2,
  28                 "name": "Level 2",
  29                 "totalNumberOfConnectors": 1
  30             }
  31         ],
  32         "pricingStructureType": {
  33             "description": "Free"
  34         },
  35         "facilityType": "Car Dealer",
  36         "accessTime": "Dealership business hours",
  37         "otherInfo": ""
  38     }
  39    }
  40  ]
This data enables developers to build solutions that help EV drivers plan their routes more efficiently, ensuring they have access to charging stations when they need them.