biz2credit-calculate-distance-lat-lon
v1.0.3
Published
This routine calculates the distance between two points (given the latitude/longitude of those points).
Downloads
2
Maintainers
Readme
This routine calculates the distance between two points (given the
latitude/longitude of those points). It is being used to calculate
the distance between two locations using GeoDataSource (TM) prodducts.
Passed to function:
lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees)
lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees)
unit = the unit you desire for results
where: 'M' is statute miles (default)
'K' is kilometers
Installation $ npm install biz2credit-calculate-distance-lat-lon
var biz2credit = require('biz2credit-calculate-distance-lat-lon')
biz2credit.getDistance(lat1, lon1, lat2, lon2, unit);
This routine checks distance is in range or not
Passed to function:
distance, range
both are in same unit (in KM, M)
var biz2credit = require('biz2credit-calculate-distance-lat-lon')
biz2credit.isInRange(dist, range);
This routine is used to sort an object of array on basis on their id Passed to function: arrOfObj = must be array of object or array of number key = key/id of object (their value must be integer type) orderBy = DESC or desc for descending order Asc or asc for ascending order (default)
var biz2credit = require('biz2credit-calculate-distance-lat-lon')
biz2credit.sortById(arrOfObj, key, orderBy);