Calculating a route with prohibited segments by intersecting polylines

This use-case describes how to calculate a routeA 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. with prohibited segments by intersecting polylinesA 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..

Benefits

Using the xRoute API makes it easy to obtain routesClosed 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. avoiding certain segments by defining a list of polylinesClosed 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..

Prerequisites

Please ensure following prerequisites are fulfilled before you start with the use case:

  • Installed and licensed PTV xRoute service

Programming Guide

The following xRoute example shows how to compute route avoiding to pass through a certain segment.

To apply the restriction, we use the GeographicRestrctions options in the route request. In particular, these options offer the possibility to specify a list of polylines via the attribute prohibitedSegmentsByIntersectingPolylines from which every segment intersected are prohibited from the routing.

In this example, the blue route is the best route without any restrictions to reach the destination. The orange route has been calculated using geographic restrictions containing the intersecting line from which the segments are prohibited. As a result a detour is observed.