2 function FOSSGISValhallaEngine(id, costing) {
8 14, // kDestination = 4;
9 14, // kDestinationRight = 5;
10 14, // kDestinationLeft = 6;
13 1, // kSlightRight = 9;
15 3, // kSharpRight = 11;
16 4, // kUturnRight = 12;
17 4, // kUturnLeft = 13;
18 7, // kSharpLeft = 14;
20 5, // kSlightLeft = 16;
21 0, // kRampStraight = 17;
22 24, // kRampRight = 18;
23 25, // kRampLeft = 19;
24 24, // kExitRight = 20;
25 25, // kExitLeft = 21;
26 0, // kStayStraight = 22;
27 1, // kStayRight = 23;
30 10, // kRoundaboutEnter = 26;
31 10, // kRoundaboutExit = 27;
32 17, // kFerryEnter = 28;
33 0, // kFerryExit = 29;
34 null, // kTransit = 30;
35 null, // kTransitTransfer = 31;
36 null, // kTransitRemainOn = 32;
37 null, // kTransitConnectionStart = 33;
38 null, // kTransitConnectionTransfer = 34;
39 null, // kTransitConnectionDestination = 35;
40 null, // kPostTransitConnectionDestination = 36;
41 21, // kMergeRight = 37;
42 20 // kMergeLeft = 38;
48 "<a href='https://gis-ops.com/global-open-valhalla-server-online/' target='_blank'>Valhalla (FOSSGIS)</a>",
51 getRoute: function (points, callback) {
53 url: OSM.FOSSGIS_VALHALLA_URL,
55 json: JSON.stringify({
56 locations: points.map(function (p) {
57 return { lat: p.lat, lon: p.lng, radius: 5 };
62 language: I18n.currentLocale()
67 success: function (data) {
70 if (trip.status === 0) {
76 trip.legs.forEach(function (leg) {
77 var legLine = L.PolylineUtil.decode(leg.shape, {
81 line = line.concat(legLine);
83 leg.maneuvers.forEach(function (manoeuvre, idx) {
84 var point = legLine[manoeuvre.begin_shape_index];
87 { lat: point[0], lng: point[1] },
88 INSTR_MAP[manoeuvre.type],
89 "<b>" + (idx + 1) + ".</b> " + manoeuvre.instruction,
90 manoeuvre.length * 1000,
95 distance = distance + leg.summary.length;
96 time = time + leg.summary.time;
102 distance: distance * 1000,
117 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_car", "auto"), true);
118 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_bicycle", "bicycle"), true);
119 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_foot", "pedestrian"), true);