Calculating alternative routes

This article discusses the use case of alternative routingClosed A route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path.. PTV xRoute provides the ability to request several alternative routes in one request.

Benefits

Sometimes, a driver can have a precise knowledge of information which might be missing in the map (traffic lights, traffic incident, damaged road, personal convenience or preference, etc...). The driver could then prefer to take another route than the theoretically optimal one. Therefore PTV xRoute proposes alternative routes of good quality (in regards to the request criteria).

Prerequisites

Check if the following prerequisites are fulfilled before you start with the use case.

  • Installed and licensed PTV xRoute and xMap services.

Programming Guide

The following xRoute example show how to request alternative routes.

This example displays the results of a request with alternative routes. For each alternative route basic information such as the traveltime and the route distance and through the corresponding result field the polylineClosed A polyline is a continuous line composed of one or more line segments given as a set of tuples with x,y and optional z coordinates. is returned.

The following xRoute example show how to request alternative routes and encoded paths and how to use the returned encoded Path to determine further information such as in this case the carbon emissions.

Related Topics