Click or drag to resize

Using Truck Attributes

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Overview

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:

  • Vehicle height, length and width
  • Unladen and gross vehicle weights
  • Vehicle type (such as truck, emergency vehicle or bus)
Note Note

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.

Note Note

In certain circumstances, it may be necessary to call IRoute.ForceRecalculate after making changes to VehicleSpec or RoutingStrategy. See ForceRecalculate for more information.

Creating the Route

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.

C#
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
No Truck

To overwrite any vehicle attributes set, set the Route object's VehicleSpec property to a new VehicleSpec object.

C#
route.VehicleSpec = new VehicleSpec();
Small Truck

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.

Note Note

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.

C#
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;
Big Truck

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.

Tip Tip

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).

C#
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;
Testing

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.

Truck Attributes