Using Truck Attributes
Some GeoBase map data files ('Truck Attributes' GBFS files) contain metadata that allows features (such as roads, tunnels and bridges) to be described in significant detail. This detail allows GeoBase to prevent vehicles from traveling along inappropriate routes. To do this, GeoBase must be given a description of the vehicle. This can be done using the VehicleSpec structure. Attributes supported in the VehicleSpec structure include:
To use Truck Attributes you will need both a region's Basemap GBFS and the region's matching Truck Attributes GBFS map files. Sample Basemap and Truck Attribute map data files can be downloaded from the Verizon Connect Spatial website.
In the code section below we will create a VehicleSpec object describing a typical truck, and apply the VehicleSpec object to our Route object. This means that any route we create will be suitable for the truck described in the VehicleSpec object.
We'll start by creating a simple route. This route, by default, passes under a bridge on Arroyo Seco Parkway, Los Angeles with a maximum height restriction of just over 13 feet.
Route route = new Route(); route.AddStop(new RouteStop(new LatLon(34.057954, -118.253753))); // start route.AddStop(new RouteStop(new LatLon(34.068194, -118.238435))); // end
To overwrite any vehicle attributes set, set the Route object's VehicleSpec property to a new VehicleSpec object.
route.VehicleSpec = new VehicleSpec();
This code will apply a VehicleSpec object describing a small truck. Because this truck is small it's unlikely you will notice the effects of routing with this VehicleSpec object. However, it is good practice to use the appropriate VehicleSpec object where possible to avoid the potential for dangerous or damaging situations.
The vehicle dimensions are specified in feet and converted to centimeters using the ConvertUnitsInt(Double, DistanceUnit, DistanceUnit) method. The MathUtil class contains other useful speed, distance and unit conversion methods.
VehicleSpec vs = new VehicleSpec(); vs.Height_cm = MathUtil.ConvertUnitsInt(10.5, // feet tall DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.Width_cm = MathUtil.ConvertUnitsInt( 7, // feet wide DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.Length_cm = MathUtil.ConvertUnitsInt(16.5, // feet long DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.UnladenWeight_kg = 5750; route.VehicleSpec = vs;
This code will apply a VehicleSpec object describing a truck approximately large enough to transport a 20' shipping container. Note that the VehicleSpec object describes the truck as having a single 24' long trailer, and carrying 2 tonnes of building materials. This truck is large enough such that variations to accommodate the height and length of the truck should be quite noticeable in the route generated.
You can use the SetLoadInfo(Int32, LoadType, UInt32) method to configure a wide variety of load combinations - including loads containing hazardous waste (identified by HAZMAT codes).
VehicleSpec vs = new VehicleSpec(); vs.Height_cm = MathUtil.ConvertUnitsInt(14, // feet tall DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.Width_cm = MathUtil.ConvertUnitsInt(9.5, // feet wide DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.Length_cm = MathUtil.ConvertUnitsInt(37, // feet long DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.NumberOfTrailers = 1; vs.MaxTrailerLength_cm = MathUtil.ConvertUnitsInt(24, // feet long DistanceUnit.FEET, DistanceUnit.CENTIMETERS); vs.UnladenWeight_kg = 8100; // truck is carrying 2 tonnes of building materials vs.SetLoadInfo(0, LoadType.BuildingMaterials, 2000); route.VehicleSpec = vs;
If you use the 'No Truck' VehicleSpec object and follow the route defined in 'Creating the Route' you'll see that GeoBase instructs you to travel underneath a bridge, indicated by a red dot (left image). However, if you use the 'Big Truck' VehicleSpec object and follow the route given you'll note that GeoBase adjusts the route to avoid the bridge (right image). This is because GeoBase recognizes that the Big Truck is too tall to fit under the bridge.