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 10, // kRoundaboutExit = 27;
31 17, // kFerryEnter = 28;
32 0, // kFerryExit = 29;
33 null, // kTransit = 30;
34 null, // kTransitTransfer = 31;
35 null, // kTransitRemainOn = 32;
36 null, // kTransitConnectionStart = 33;
37 null, // kTransitConnectionTransfer = 34;
38 null, // kTransitConnectionDestination = 35;
39 null, // kPostTransitConnectionDestination = 36;
40 21, // kMergeRight = 37;
41 20 // kMergeLeft = 38;
47 "<a href='https://gis-ops.com/global-open-valhalla-server-online/' target='_blank'>Valhalla (FOSSGIS)</a>",
50 getRoute: function (points, callback) {
52 url: OSM.FOSSGIS_VALHALLA_URL,
54 json: JSON.stringify({
55 locations: points.map(function (p) {
56 return { lat: p.lat, lon: p.lng, radius: 5 };
61 language: I18n.currentLocale()
66 success: function (data) {
69 if (trip.status === 0) {
75 trip.legs.forEach(function (leg) {
76 var legLine = L.PolylineUtil.decode(leg.shape, {
80 line = line.concat(legLine);
82 leg.maneuvers.forEach(function (manoeuvre, idx) {
83 var point = legLine[manoeuvre.begin_shape_index];
86 { lat: point[0], lng: point[1] },
87 INSTR_MAP[manoeuvre.type],
88 "<b>" + (idx + 1) + ".</b> " + manoeuvre.instruction,
89 manoeuvre.length * 1000,
94 distance = distance + leg.summary.length;
95 time = time + leg.summary.time;
101 distance: distance * 1000,
116 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_car", "auto"), true);
117 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_bicycle", "bicycle"), true);
118 OSM.Directions.addEngine(new FOSSGISValhallaEngine("fossgis_valhalla_foot", "pedestrian"), true);