Use Cases > PTV xRoute > How to Calculate Route Information

How to Calculate Route Information

Introduction

Basically, the distance and travel time of a given route are calculated and returned as a result list. Furthermore, the internal costs could be indicated but this is only relevant in comparison to alternative routes. Last but not least the boolean value of caused violations are delivered by the result object. Please notice, this is a simple but fast route calculation. The next figure shows the output of a simple routing.

General structure

The method is called "calculateRouteInfo". Following arguments are available:

Programming Guide

The following code sample illustrates how to calculate a basic route information calling the above name method. To keep the sample simple, the argument "exceptionPaths" is not used.

Instantiate client

Define locations for start and destination

Create CallerContext

Add RoutingOption

Call method