code: function(points, callback, fromIndex, toIndex) {
  	var newPoints = [], i, len;
  	try {
  		for (i = 0, len = points.length; i < len; i++) {
  			if (!points[i].lat || !points[i].lng) {
  				continue;
  			}
  			newPoints.push(points[i]);
  		}
  		calculateFromGPX(newPoints, callback, fromIndex, toIndex);
  	} catch(e) {
  		callback(e, null);
  	}
  }
docs: Calculate speed and distance
  
  Same way as GPX