function recordRoute(call, callback) {
  var point_count = 0;
  var feature_count = 0;
  var distance = 0;
  var previous = null;
  // Start a timer
  var start_time = process.hrtime();
  call.on('data', function(point) {
    point_count += 1;
    if (checkFeature(point).name !== '') {
      feature_count += 1;
    }
    /* For each point after the first, add the incremental distance from the
     * previous point to the total distance value */
    if (previous != null) {
      distance += getDistance(previous, point);
    }
    previous = point;
  });
  call.on('end', function() {
    callback(null, {
      point_count: point_count,
      feature_count: feature_count,
      // Cast the distance to an integer
      distance: distance|0,
      // End the timer
      elapsed_time: process.hrtime(start_time)[0]
    });
  });
}
function recordRoute(call, callback) {
  var point_count = 0;
  var feature_count = 0;
  var distance = 0;
  var previous = null;
  // Start a timer
  var start_time = process.hrtime();
  call.on('data', function(point) {
    point_count += 1;
    if (checkFeature(point).name !== '') {
      feature_count += 1;
    }
    /* For each point after the first, add the incremental distance from the
     * previous point to the total distance value */
    if (previous != null) {
      distance += getDistance(previous, point);
    }
    previous = point;
  });
  call.on('end', function() {
    callback(null, {
      point_count: point_count,
      feature_count: feature_count,
      // Cast the distance to an integer
      distance: distance|0,
      // End the timer
      elapsed_time: process.hrtime(start_time)[0]
    });
  });
}
function recordRoute ( call , callback ) { var point_count = 0 ; var feature_count = 0 ; var distance = 0 ; var previous = null ; // Start a timer var start_time = process . hrtime ( ) ; call . on ( 'data' , function ( point ) { point_count += 1 ; if ( checkFeature ( point ) . name !== '' ) { feature_count += 1 ; } /* For each point after the first, add the incremental distance from the
     * previous point to the total distance value */ if ( previous != null ) { distance += getDistance ( previous , point ) ; } previous = point ; } ) ; call . on ( 'end' , function ( ) { callback ( null , { point_count : point_count , feature_count : feature_count , // Cast the distance to an integer distance : distance | 0 , // End the timer elapsed_time : process . hrtime ( start_time ) [ 0 ] } ) ; } ) ; }
recordRoute handler. Gets a stream of points, and responds with statistics
about the "trip": number of points, number of known features visited, total
distance traveled, and total time spent.
@param {Readable} call The request point stream.
@param {function(Error, routeSummary)} callback The callback to pass the
response to
recordRoute handler . Gets a stream of points and responds with statistics about the trip : number of points number of known features visited total distance traveled and total time spent .
Record a route