Description
Commercial Vehicle Restrictions (CVR) are composed of directives to the routing engine that guides the behavior and attributes of commercial vehicles making trips along the route. Depending upon vehicle attributes provided (such as height, width, length, weight) and the commercial vehicle restriction attributes present in the road network, decision is made whether to allow to route a particular vehicle over a segment or not. If there is no commercial vehicle restriction attribute present in road network, input restriction parameters will have no effect in the resultant route.
Optional Parameters
Following optional parameters can be get or set in GetRouteRequest object:
Parameter | Type | Description |
---|---|---|
looseningBarrierRestrictions | Boolean | Specifies whether the barriers will be ignored when determining the route.These restrictions are applicable when a commercial vehicle is prohibited from traversing a segment due to local ordinance or a commercial vehicle is allowed on the segment but only when it must (for example, last mile access, local delivery, and so on). Routes where a barrier has been removed will still have a higher route cost even if the route it shorter/faster than a route with no barrier. |
Vehicle Attributes
Parameter | Type | Description |
---|---|---|
vehicleType | String | Choose either ALL or one of the types of vehicles:
|
weight | Double | Specifies the maximum weight of a vehicle. Any vehicles over this value will
be restricted when determining the route. The units of weight are:
|
height | Double | Specifies the maximum height of a vehicle. Any vehicles over this value will
be restricted when determining the route. The units of height are:
|
length | Double | Specifies the maximum length of a vehicle. Any vehicles over this value will
be restricted when determining the route. The units of length are:
|
width | Double | Specifies the maximum width of a vehicle. Any vehicles over this value will
be restricted when determining the route. The units of width are:
|
Code Example
Simple Route with start and end points.
IPoint startPoint1 = new Point(SpatialInfo.create(CoordSysConstants.longLatWGS84), new
DirectPosition(-73.994062, 40.76312));
IPoint startPoint2 = new Point(SpatialInfo.create(CoordSysConstants.longLatWGS84), new
DirectPosition(-73.985124, 40.765067));
IPoint endPoint1 = new Point(SpatialInfo.create(CoordSysConstants.longLatWGS84), new
DirectPosition(-74.005972, 40.714269));
IPoint endPoint2 = new Point(SpatialInfo.create(CoordSysConstants.longLatWGS84), new
DirectPosition(-73.9978, 40.7509));
List < IPoint > startPoints = new ArrayList < > ();
startPoints.add(startPoint1); startPoints.add(startPoint2);
List < IPoint > endPoints = new ArrayList < > ();
endPoints.add(endPoint1);
endPoints.add(endPoint2);
boolean returnOptimalRoutes = true;
GetRouteCostMatrixRequest.Builder costMatrixRequestBuilder = new
GetRouteCostMatrixRequest.Builder(startPoints,
endPoints).returnOptimalRoutesOnly(returnOptimalRoutes).DBResource("US");
VehicleAttributes attributes = new VehicleAttributes(VehicleType.ALL);
attributes.setLooseningBarrierRestrictions(false);
Length height = new Length(50.0, LinearUnit.METER);
attributes.setHeight(height);
Length length = new Length(50.0, LinearUnit.METER);
attributes.setLength(length);
Length width = new Length(50.0, LinearUnit.METER);
attributes.setWidth(width);
Weight wgt = new Weight(20000, WeightUnit.POUND);
attributes.setWeight(wgt);
costMatrixRequestBuilder.vehicleAttr(attributes);
GetRouteCostMatrixRequest matrixRequest = costMatrixRequestBuilder.build();
matrixResponse = m_gra.getRouteCostMatrix(matrixRequest);