Distance matrix fixes
This commit is contained in:
		
							parent
							
								
									e9369293dc
								
							
						
					
					
						commit
						d4e2b5a3b8
					
				| @ -47,7 +47,7 @@ module.exports = function () { | ||||
| 
 | ||||
|                 var result = json['durations'].map(row => { | ||||
|                     var hashes = {}; | ||||
|                     row.forEach((v, i) => hashes[tableRows[0][i+1]] = v); | ||||
|                     row.forEach((v, i) => { hashes[tableRows[0][i+1]] = isNaN(parseInt(v)) ? '' : v; }); | ||||
|                     return hashes; | ||||
|                 }); | ||||
| 
 | ||||
|  | ||||
| @ -18,18 +18,18 @@ var OSRMError = class extends Error { | ||||
|         this.logTail(this.log, this.lines, callback); | ||||
|     } | ||||
| 
 | ||||
|     toString (callback) { | ||||
|         this.extract((tail) => { | ||||
|             callback(util.format('*** %s\nLast %s from %s:\n%s\n', this.msg, this.lines, this.log, tail)); | ||||
|         }); | ||||
|     } | ||||
|     // toString (callback) {
 | ||||
|     //     this.extract((tail) => {
 | ||||
|     //         callback(util.format('*** %s\nLast %s from %s:\n%s\n', this.msg, this.lines, this.log, tail));
 | ||||
|     //     });
 | ||||
|     // }
 | ||||
| 
 | ||||
|     logTail (logPath, n, callback) { | ||||
|         var expanded = path.resolve(this.TEST_FOLDER, logPath); | ||||
|         fs.exists(expanded, (exists) => { | ||||
|             if (exists) { | ||||
|                 fs.readFile(expanded, (err, data) => { | ||||
|                     var lines = data.trim().split('\n'); | ||||
|                     var lines = data.toString().trim().split('\n'); | ||||
|                     callback(lines | ||||
|                         .slice(lines.length - n) | ||||
|                         .map(line => util.format('    %s', line)) | ||||
|  | ||||
| @ -82,8 +82,10 @@ module.exports = function () { | ||||
|             params = this.overwriteParams(defaults, userParams); | ||||
| 
 | ||||
|         params.coordinates = waypoints.map(w => [w.coord.lon, w.coord.lat].join(',')); | ||||
|         // TODO what was 'type' here?
 | ||||
|         // params = params.concat(waypoints.map(w => [w.type, [w.coord.lat, w.coord.lon].join(',')]));
 | ||||
|         var srcs = waypoints.map((w, i) => [w.type, i]).filter(w => w[0] === 'src').map(w => w[1]), | ||||
|             dsts = waypoints.map((w, i) => [w.type, i]).filter(w => w[0] === 'dst').map(w => w[1]); | ||||
|         if (srcs.length) params.sources = srcs.join(';'); | ||||
|         if (dsts.length) params.destinations = dsts.join(';'); | ||||
| 
 | ||||
|         return this.requestPath('table', params, callback); | ||||
|     }; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user