(waypoints)
| 8 | |
| 9 | // Parse semicolon-separated waypoints from command line arguments |
| 10 | function parseWaypoints(waypoints) { |
| 11 | if (waypoints == undefined) { |
| 12 | return undefined; |
| 13 | } |
| 14 | return waypoints.split(';').map((waypoint) => { |
| 15 | const [lon, lat] = waypoint.split(','); |
| 16 | return [parseFloat(lon), parseFloat(lat)]; |
| 17 | }); |
| 18 | } |
| 19 | const waypoints = parseWaypoints(args[1]) || [[7.41337, 43.72956],[7.41546, 43.73077]]; |
| 20 | const osrm = new OSRM({path, algorithm: 'MLD'}); |
| 21 |