Displaying Routes

Building and rendering route data

Route simulation and playbacks

We provide support for the plotting and drawing of routes.

In this section:

Creating a Route

A route is expressed as a series of vertices which define a poly-line. Each vertex has a position, and some related attribute data (such as color and width). If a route has N vertices, it has (N-1) links between vertices; it is the visualisation of these links to which the attributes apply. Conventionally, the attributes of the first vertex in the route are discarded; generally, this means that the attributes for a poly-line segment from source to destination use the attributes of the destination. This information is relevant only if you are interested in visualizing multiple colors, widths, or other attributes in the same route, and can otherwise be disregarded.

To assist with creating a route, the RouteBuilder can be used. This class defines a fluent interface for adding a set of positions to a route and changing attributes while doing so. This can be accomplished as follows:

The previous code sample illustrates building a set of vertices to represent a multi-colored route around the Transamerica Pyramid building in San Francisco. The route builder accepts input positions as tuples of (latitudeDegrees, longitudeDegrees, altitudeMeters) or LatLongAltitude objects.

Submitting a Route

Once a route has been built using the RouteBuilder, it can be submitted to the RouteService. On submission to the route service, the platform constructs and maintains a visualisation for the route; there is no further action required from the application to draw the route. A pointer to a Route is provided to the application by the RouteService on creation of a route, which should be retained such that the route can later be destroyed, demonstrated as follows;

Removing a route

The route can be destroyed by the application using RouteService, by providing the pointer to the route to be destroyed. This can be accomplished as follows;

Note that the application should not delete the pointer to the route; the route lifetime is determined by calls to CreateRoute and DestroyRoute. The pointer to the route is no longer valid after a call to DestroyRoute.


RouteDrawingExample – This example illustrates how to use the RouteBuilder and RouteService to build, create and destroy routes.

The example is available here.

RouteThicknessPolicy – This example illustrates how to use built-in route thickness policy types to determine how the route thickness behaves. The example illustrates a route which has an identity thickness policy applied such that it does not change, an altitude based thickness policy such that the route thickens as the camera altitude increases, and a custom application defined thickening policy, which animates the route to thicken and thin.

The example is available here.