1

Include station name in accessibility calculation results

This commit is contained in:
Alex Yatskov 2015-01-05 15:46:12 +09:00
parent 3eacfa63bc
commit 3b6197b0f8
2 changed files with 2218 additions and 1108 deletions

File diff suppressed because it is too large Load Diff

View File

@ -52,14 +52,19 @@ function queryPosition(gc, address, cache, sequence, callback) {
function buildAccess(reviewData, stationData, accessibility) {
_.each(reviewData, function(reviewItem) {
var distMin = Number.MAX_VALUE;
var station = '';
console.log('Computing access for: \n\t%s', reviewItem.name);
_.each(stationData, function(stationItem) {
_.each(stationData, function(stationItem, stationName) {
var distance = geolib.getDistance(reviewItem.geo, stationItem.geo);
distMin = Math.min(distance, distMin);
if (distance < distMin) {
station = stationName;
distMin = distance;
}
});
reviewItem.distanceToStation = distMin;
reviewItem.distanceToStn = distMin;
reviewItem.closestStn = station;
});
}