Click or drag to resize

Telogis.GeoBase.Routing.DrivingEvent

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

DrivingEvent inherits from Routing.Direction.

A base class, populated server-side, that represents an event that occurs en route -- such as a driving direction or movement.

Functions
NameDescription
getDistance (String units)

Finds the distance covered by the Routing.DrivingEvent, in the given units.

JavaScript
// Create a route, then..
var miles = Telogis.GeoBase.DistanceUnit.MILES;
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength(); i++) {
        list +=  '- Distance covered by DrivingEvent ' + count + ': ' +
        result.getDirection(i).dir.getDistance(miles) + ' miles\n';
        count++;
    } alert (list);
});
Arguments
  • (Optional) units (String) - The DistanceUnit code describing the units to return the event's distance in. Defaults to DistanceUnit.MILES.

Returns

Number - The event's distance, in the specified Routing.DrivingEvent.getDistance.units.

getHeading ()

Gets the clockwise angle from north that describes the orientation that the Routing.DrivingEvent occurs with.

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength(); i++) {
        list +=  '- DrivingEvent ' + count + ' heading: ' +
        result.getDirection(i).dir.getHeading() + ' degrees\n';
        count++;
    } alert (list);
});
Returns

Number - The heading, in degrees, of the driving event.

getLastStreet ()

Gets the name of the Routing.DrivingEvent's street after it has taken place (this may differ from the name returned by Routing.DrivingEvent.getTargetStreet if, for example, the event describes a street name change).

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength(); i++) {
        list +=  '- Street following DrivingEvent ' + count + ': ' +
        result.getDirection(i).dir.getLastStreet() + '\n';
        count++;
    } alert (list);
});
Returns

String - The final street name for the event.

getLocation ()

Gets the latitude-longitude coordinates describing the location that the Routing.DrivingEvent occurs at.

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength(); i++) {
        list +=  '- DrivingEvent ' + count + ' occurs at LatLon: ' +
        result.getDirection(i).dir.getLocation() + '\n';
        count++;
    } alert (list);
});
Returns

LatLon - The location of the driving event.

getNotes ()

Finds any noteworthy features of the calling Routing.DrivingEvent.

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength (); i++) {
        check = result.getDirection(i).dir.getNotes();
        if (check != '') {
        list += '- DrivingEvent ' + count + ' notes: ' +
        result.getDirection(i).dir.getNotes() + '\n';
        }
        count++;
    } alert (list);
});
Returns

Array - An array of Routing.DrivingNotes, each describing some important aspect of the driving event. If no such notes are present, an empty array is returned. Changing the returned array will modify the event.

getPoints ()

Gets an array of LatLons that describe a path associated with the Routing.DrivingEvent, and can be plotted on a map layer to display it.

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength (); i++) {
        list +=  '- DrivingEvent ' + count + ' path described by LatLon array: ' +
        result.getDirection(i).dir.getPoints() + '\n';
        count++;
    } alert (list);
});
Returns

Array - The list of locations describing the driving event.

getTargetStreet ()

Gets the initial name of the street that the Routing.DrivingEvent occurs on. This may differ from the name returned by Routing.DrivingEvent.getLastStreet if, for example, the event describes a street name change).

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength (); i++) {
        list +=  '- DrivingEvent ' + count + ' occurs on street: ' +
        result.getDirection(i).dir.getTargetStreet() + '\n';
        count++;
    } alert (list);
});
Returns

String - The initial street name for the event.

getTime ()

Gets the amount of time that the Routing.DrivingEvent takes.

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength (); i++) {
        list +=  '- DrivingEvent ' + count + ' will take: ' +
        result.getDirection(i).dir.getTime() + ' seconds (approx)\n';
        count++;
    } alert (list);
});
Returns

Number - The duration of the driving event, in seconds.

toString ()

Gets the English directions describing the Routing.DrivingEvent. Also synonym getEnglishDirections.

JavaScript
// Create a route, then..
aRoute.getDirections (function (result) {
    var count = 1;
    var list = '';
    for (var i = 0; i < result.getLength(); i++) {
        list +=  '- DrivingEvent ' + count + ' instructions: ' +
        result.getDirection(i).dir.toString() + '\n';
        count++;
    } alert (list);
});
Returns

String - The directions associated with the driving event.