Package Exports
- geo-distances
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (geo-distances) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
geo-distances
A geographical distance calculator. Calculates distance between two points in a defined range using haversine formula.
Installation
Install using npm:
$ npm install geo-distances
Example
To get the distance between two points in Kilometers (KM), define starting point and end point in data.json file. Range and Unit of distance can be set as per requirement.
let geoDistances = require('geo-distances'),
starting_point = { "latitude": "53.339428", "longitude": "-6.257664" },
range = '100',
unit = 'km',
filepath = __dirname+'/data.json';
//example data.json
data.json = [{ "latitude": "53.038056", "longitude": "-7.653889" }]
let distances = geoDistances(filepath, starting_point, range, unit);
console.log(distances);
Usage
geo-distances(start, end, [options])
The following types are accepted in the unit option:
milesormiyardsfeetkilometersorkmmeters
Example:
starting_point = { "latitude": "57.319428", "longitude": "-2.2571864" },
filepath = __dirname+'/data.json', //remember to provide an array of Objects
unit = 'mi',
range = '10000';
let geoDistances = require('geo-distances')
let distances = geoDistances(filepath, starting_point, range, unit);
//example data.json
data.json = [{ "latitude": "50.9096375", "longitude": "-4.043701" }];