Click or drag to resize

Routing Concept

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

A Route object consists of a number of RouteStop objects. Each Route object must contain at least two stops: a start and an end. There may be any number of stops in between. Shown below is a short route between three stops. The stops are visited in their numbered order: 1, 2, 3.

routing demoroute

Routes with multiple points typically have many possible paths, but only one path will be 'optimum'. The optimum route is usually either the shortest or fastest - although you can define your own criteria by modifying the RoutingStrategy.

Routing is the process of determining the optimum order in which to visit the stops, and the path between them.

Tutorials

Routing Tutorials

Create a route, generate driving directions, calculate times and distances between stops and avoid specified areas.

Detailed Explanation

GeoBase creates routing instructions and schematics based on the stops that a route needs to visit and the waypoints the route needs to pass by. Stops a route needs to visit are represented by RouteStop objects. Waypoints a route needs to go by (but not stop at) are represented by Waypoint objects, which instantiate a subclass of the RouteStop class. Both route stops and waypoints are defined (and created) in terms of latitude and longitude coordinates. RouteStop objects (including Waypoint objects) can either have a fixed order along the route or be rearranged by GeoBase to minimize either time or distance. A route can also include optional start (Route.Start) and end (Route.End) stops, which can be the same location.

When all of the RouteStop (including Waypoint) objects for a route are defined they need to be added to a Route object. They are added using Route.AddStop(RouteStop). Conveniently, GeoBase ignores multiple stops at the same location when using the AddStop method.

Tip Tip

If you don't want GeoBase to intelligently reorder the stops you can specify an integer as an optional second parameter to Route.AddStop(RouteStop, int). This parameter defines an individual RouteStop object's order in the route.

At this point Route.OptimizeStops() can be called to minimize the route's time or distance, depending on the RoutingStrategy property of the route. Included routing strategies are:

The Routing strategy specifies the main criterion to use when generating routing instructions. You can customize a routing strategy in a variety of ways:

  • You can modify the routing strategy (except for RoutingStrategyForPedestrian) to take into account the effect of traffic. For details on how to implement this, see the Routing with Traffic tutorial.
  • You can provide constraints that must be taken into consideration by setting the VehicleSpec property of the Route object or by setting properties on the routing strategy such as AllowUTurns, RoadCrossingBehavior, or UseTollRoads. Constraints work by assigning a prohibitive cost to directions that violate the constraint. Using constraints is illustrated in the Using Truck Attributes tutorial.
  • You can use GeoFences to avoid certain areas. For details on how to implement this, see the Avoiding a Given Area tutorial.
  • You can introduce time windows on when route stops must be visited. For details on how to do this, see the Delivery TimeWindows tutorial.
  • You can introduce your own custom code to modify the cost of some routing options. For an example of how to do this, see the Modifying the Routing Strategy tutorial.
Note Note

There is no built-in support for modifying the routing strategy so that it takes traffic signals into account. You can, however, modify the routing strategy yourself, using the traffic signal information that is available on a StreetLink object.

Driving Directions

Using a Directions object GeoBase can generate visual and textual driving directions for the route, and can also optimize the route according to a user-defined strategy. Directions objects can also be drawn on a map (add the Directions object to your RenderList) and described in natural language form.

Displaying a Route

Directions and Route objects are both IMapRenderers, meaning that RouteStop objects (or the Point objects linking them) can be rendered on a Map or MapCtrl object. A RendererList needs to be used to render RouteStop and Point objects together on the same map.

For even more control, the individual components (Direction objects) that make up a Directions object can be manipulated and rendered separately using the same technique. Each direction object holds detailed information about a portion of the route, including an instruction string, the distance to the next Direction, and the Point objects that detail the current Direction. Each Direction object is an instance of one of two subclasses - Movement, which represents a driving instruction to turn at an intersection, and Note, which represents useful but non-essential information such as landmark locations or road signs. The string in the Instructions property, however, contains information that is essential for the successful traversal of the route.

For a more detailed discussion on rendering see the Rendering concept and Render Modes in Detail.

Routing Across State and National Borders

When routing across neighboring countries or regions that require multiple GBFS data files, it is important that the map data files for these countries and regions are of the same age. For example, Bulgaria_12Q2 should be used with Greece_12Q2, Romania_12Q2, Macedonia_12Q2 and Serbia_12Q2 rather than the older 12Q1 or newer 12Q3 files for these regions.

Roadways naturally change over time, and these changes are reflected as data is updated. For this reason, roads in different data may fail to align correctly at state or country borders when one data file is older than another. This will in turn prevent successful or optimal routing.

Related Classes
  • Directions - may be used to obtain driving directions along a route

  • DistanceMeter - may be used to measure the distance along a route (as opposed to the straight-line distance between start and end-points)

  • Route - encompasses a series of RouteStop objects and provides methods to: calculate times and distances along a route, adjust vehicle types and parameters to honor physical constraints, save and load route information from XML

  • RouteStop - a stop on a Route. Stops may be intelligently reordered to minimize time, distance or some other criterion

  • RoutingStrategy - a strategy used for route optimization. You may create your own custom strategy (for example, to avoid highways). See Modifying the Routing Strategy (tutorial)

  • RoutingStrategyFastest - a pre-defined RoutingStrategy to determine the fastest route.

  • RoutingStrategyForPedestrian - a pre-defined RoutingStrategy to determine the best route for a pedestrian.

  • RoutingStrategyShortest - a pre-defined RoutingStrategy to determine the shortest route

  • TurnBox - a TurnBox graphically displays an upcoming turn, as the driver would see it

  • VehicleMarker - may be used to show the location of a vehicle on a map

  • Waypoint - a special type of Routestop that causes a route to traverse the closest street but not to include any 'arrive' or 'depart' movements.

Next Topic