1 function FOSSGISValhallaEngine(id, costing) {
7 14, // kDestination = 4;
8 14, // kDestinationRight = 5;
9 14, // kDestinationLeft = 6;
12 1, // kSlightRight = 9;
14 3, // kSharpRight = 11;
15 4, // kUturnRight = 12;
16 4, // kUturnLeft = 13;
17 7, // kSharpLeft = 14;
19 5, // kSlightLeft = 16;
20 0, // kRampStraight = 17;
21 24, // kRampRight = 18;
22 25, // kRampLeft = 19;
23 24, // kExitRight = 20;
24 25, // kExitLeft = 21;
25 0, // kStayStraight = 22;
26 1, // kStayRight = 23;
29 10, // kRoundaboutEnter = 26;
30 11, // kRoundaboutExit = 27;
31 17, // kFerryEnter = 28;
32 0, // kFerryExit = 29;
33 ...Array(7).fill(), // irrelevant transit maneuvers
34 21, // kMergeRight = 37;
35 20 // kMergeLeft = 38;
41 "<a href='https://gis-ops.com/global-open-valhalla-server-online/' target='_blank'>Valhalla (FOSSGIS)</a>",
44 getRoute: function (points, callback) {
46 url: OSM.FOSSGIS_VALHALLA_URL,
48 json: JSON.stringify({
49 locations: points.map(function (p) {
50 return { lat: p.lat, lon: p.lng };
55 language: I18n.currentLocale()
60 success: function (data) {
63 if (trip.status === 0) {
69 trip.legs.forEach(function (leg) {
70 var legLine = L.PolylineUtil.decode(leg.shape, {
74 line = line.concat(legLine);
76 leg.maneuvers.forEach(function (manoeuvre, idx) {
77 var point = legLine[manoeuvre.begin_shape_index];
80 { lat: point[0], lng: point[1] },
81 INSTR_MAP[manoeuvre.type],
82 "<b>" + (idx + 1) + ".</b> " + manoeuvre.instruction,
83 manoeuvre.length * 1000,
88 distance = distance + leg.summary.length;
89 time = time + leg.summary.time;
95 distance: distance * 1000,
110 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_car", "auto"), true);
111 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_bicycle", "bicycle"), true);
112 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_foot", "pedestrian"), true);