nd-cust-geo
v1.0.0
Published
We have some customer records in a text file (customers.txt) -- one customer per line, JSON lines formatted. We want to invite any customer within 100km of Dublin for some food and drinks on us. Write a program that will read the full list of customers an
Downloads
5
Readme
Get customer list by geo location
The nd-cust-geo Node library provides convenient access to the user list from given source file within passed range.
###Installation Install the package with:
npm install nd-cust-geo --save
Include and set keys
var geolib = require('nd-cust-geo');
var originlat='53.339428';
var originlong = '-6.257664';
var filename = 'customers.txt';
var range = 100;
var sortBy ='user_id';
geolib.setCustParams(originlat,originlong,filename,range,sortBy);
geolib.getcustomers().then(result=>{
console.log(result);
});
Sample File Format
{"latitude": "52.986375", "user_id": 12, "name": "Christina McArdle", "longitude": "-6.043701"}
{"latitude": "51.92893", "user_id": 1, "name": "Alice Cahill", "longitude": "-10.27699"}
{"latitude": "51.8856167", "user_id": 2, "name": "Ian McArdle", "longitude": "-10.4240951"}
{"latitude": "52.3191841", "user_id": 3, "name": "Jack Enright", "longitude": "-8.5072391"}
Submit issues
You can raise an issue in this repo or mail me at [email protected]