EMS.Service.Rank

Ranks points relative to a reference point in terms of routing.  This answers such questions as “What point is closest if I am driving but don’t want to use toll roads?”.

Response

{
    points[]: {EMS.RankedPoint}          // An array of results in order of "closest"
}
Summary
EMS.Service.RankRanks points relative to a reference point in terms of routing.
Constructor
EMS.Service.Rank
Functions
rank
normalizeTurns a javascript query into one that can be used directly against the server.

Constructor

EMS.Service.Rank

Functions

rank

rank: function(query,
callback)

Example

var query = {
    "start": {lon: 144.6534, lat: -36.5534},
    "points":[{lon: 144.6424, lat: -37.5531}, {lon: 144.3383, lat: -36.3344}],
    "method": EMS.RouteMethod.FASTEST,
    "mode": EMS.RouteMode.FOOT,
    "tolls": false
}

var service = new EMS.Service.Rank();
service.rank(query, function(response, status) {
    if (status == EMS.Status.OK) {
        // Success

    } else {
        // Failure
        alert(response.message);
    }
});

Parameters

query{Object} is a request object which must have at least an attribute “reference” and “points”, an non empty array.
callback{Function} is the callback function.

normalize

normalize: function(query)

Turns a javascript query into one that can be used directly against the server.  This creates a new object with only the necessary attributes that the server requires, ensuring that rubbish is stripped off.

Parameters

query{Object} is the query object to normalize.

Returns

{Object} Returns a normalized query which can be sent directly to the server.

rank: function(query,
callback)
normalize: function(query)
Turns a javascript query into one that can be used directly against the server.
Close