]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/routing_engines/cloudmade_foot.js
Move more engine-specific stuff out of main .js
[rails.git] / app / assets / javascripts / routing_engines / cloudmade_foot.js
1 // CloudMade foot engine
2 // *** again, this should be shared from a Cloudmade library somewhere
3 // *** this API key is taken from some example code, not for real live use!
4 // http://cloudmade.com/documentation/routing
5
6 OSM.RoutingEngines.list.push({
7         name: 'Foot (CloudMade)',
8         draggable: true,
9         getRoute: function(final,points) {
10                 var url="http://routes.cloudmade.com/8ee2a50541944fb9bcedded5165f09d9/api/0.3/";
11                 var p=[];
12                 for (var i=0; i<points.length; i++) {
13                         p.push(points[i][0]);
14                         p.push(points[i][1]);
15                 }
16                 url+=p.join(',');
17                 url+="/foot.js";
18                 this.requestJSONP(url+"?callback=");
19         },
20         gotRoute: function(router,data) {
21                 console.log(data);
22                 // *** todo
23                 // *** will require some degree of refactoring because instruction text is pre-assembled
24                 // *** otherwise largely like OSRM (funny that)
25         }
26 });
27