Side of the street restrictions for Route Locations

This article discusses the use case of calculating a routeClosed 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. taking into account the side of the street on which the waypointClosed A waypoint is a geographic location used to specify start, destination and possible stopovers for a route. is located.


In some use cases, it is forbidden for the delivery vehicleClosed The term vehicle describes what is being routed or planned for. Vehicles are used in route calculation, distance matrix calculation and effectively also in tour planning. In route calculation, vehicle properties like overall size, weight and speed are in focus. In tour planning, it is vehicle properties like capacity and availability. Commonly a vehicle is motorized, like a truck - including its trailer or a car. However also a bike or even a pedestrian are included in this definition. (or even the delivery man) to cross the street to reach their destination. Therefore, it is mandatory to take into account the side of the street of the route locationClosed A route location is the position of an object to be routed to or from, which contains additional information on how to link this position to the road network and whether or or not this position is actually reached. Route locations are used as the input for route calculation and optimization throughout PTV xServer. during the route calculation, in order to start or arrive on the same side of the road as the route location.


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 examples show how to define that a location should be approached or departed on the same side of the street as the location itself.

This restriction can be applied independently on each OffRoadWaypoint or OnRoadWaypoint. Set the sideOfStreetRestriction attribute to SAME_SIDE_AS_LOCATION to specify that the road side of the location should be respected for this waypoint.

Please note that the restriction is only supported for OffRoadWaypoint and OnRoadWaypoint, for the start, the destination or any intermediate waypoint.
For intermediate waypoints, the restriction is applied for the arrival and the departure. Therefore, the vehicle is not allowed to make a u-turn on the waypoint.

var map = new L.Map('map', { center: [49.591270, 6.124217], zoom: 17 }); // Add tile layer to map var tileUrl = xServerUrl + '/services/rest/XMap/tile/{z}/{x}/{y}'; var tileLayer = new L.TileLayer(tileUrl, { minZoom: 3, maxZoom: 18, noWrap: true }).addTo(map); var outputString = ''; var start = { "x": 6.1232, "y": 49.5915 }; var destination = { "x": 6.1244, "y": 49.5915 }; function calculateSpecificRoute(sideOfStreetRestriction) { xroute.calculateRoute({ "waypoints" : [{ "$type": "OffRoadWaypoint", "location": { "offRoadCoordinate": start, "sideOfStreetRestriction": sideOfStreetRestriction } }, { "$type": "OffRoadWaypoint", "location": { "offRoadCoordinate": destination, "sideOfStreetRestriction": sideOfStreetRestriction } }], "resultFields": { "polyline": true }, "geometryOptions": { "responseGeometryTypes": ["GEOJSON"] } }, function(route, exception) { var geoJson = route.polyline.geoJSON; if (sideOfStreetRestriction && sideOfStreetRestriction == 'SAME_SIDE_AS_LOCATION') { displayGeoJson(geoJson, '#ffa225', 4); outputString += 'side of street restricted route: ' + route.distance + 'm'; } else { displayGeoJson(geoJson, '#2882C8', 12); outputString += 'standard route: ' + route.distance + 'm'; } }); }; function displayGeoJson(geoJson, color, weight) { var jsonObject = JSON.parse(geoJson); var geoJsonLayer = new L.GeoJSON(jsonObject, { style: { color: color, weight: weight } }).addTo(map); map.fitBounds(geoJsonLayer.getBounds()); }; new[start.y, start.x], { color: 'green', fillOpacity: 0.7, radius: 3 }).addTo(map); new[destination.y, destination.x], { color: 'red', fillOpacity: 0.7, radius: 3 }).addTo(map); calculateSpecificRoute("ANY_SIDE"); outputString += "; "; calculateSpecificRoute("SAME_SIDE_AS_LOCATION"); print(outputString);

In this example, the blue route has been calculated using an OffRoadRouteLocation with the default setting of ANY_SIDE for the field sideOfStreetRestriction. It is allowed to cross the street at start in order to reach the destination as fast as possible.
The orange route has been calculated considering the side of the street at which the waypoint is located for each OffRoadWaypoint. Therefore, it is forbidden to cross the street at the start. The vehicle should use the next roundabout to be able to reach the destination.

Related Topics