public/javascripts/vendor/javascripts/geolib.js
function(coords) {

			var dist = 0, last;
			for (var i = 0, l = coords.length; i < l; ++i) {
				if(last) {
					dist += geolib.getDistance(coords[i], last);
				}
				last = coords[i];
			}

			return dist;

		}
function(coords) {

			var dist = 0, last;
			for (var i = 0, l = coords.length; i < l; ++i) {
				if(last) {
					dist += geolib.getDistance(coords[i], last);
				}
				last = coords[i];
			}

			return dist;

		}
function ( coords ) { var dist = 0 , last ; for ( var i = 0 , l = coords . length ; i < l ; ++ i ) { if ( last ) { dist += geolib . getDistance ( coords [ i ] , last ) ; } last = coords [ i ] ; } return dist ; }
Calculates the length of a given path

@param		mixed		array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...]
@return		integer		length of the path (in meters)
Calculates the length of a given path