forked from alletsz/devrel-workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouting.js
More file actions
26 lines (21 loc) · 711 Bytes
/
routing.js
File metadata and controls
26 lines (21 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Get an instance of the routing service version 8:
var router = platform.getRoutingService(null, 8);
// Create the parameters for the routing request:
var routingParameters = {
transportMode:'car',
routingMode: 'fast',
origin: '52.4569927,13.380545',
destination: '52.52407865,13.429371',
return:'polyline',
};
// Define a callback function to process the routing response:
var onResult = function(result) {
console.log(result);
};
// error callback function
var onError = function(error) {
alert(error.message);
};
// Call calculateRoute() with the routing parameters,
// the callback and an error callback function
router.calculateRoute(routingParameters, onResult, onError);