Skip to content

Find records within a radius(proximity) using haversine or spherical law of cosines

License

Notifications You must be signed in to change notification settings

jeremyrajan/invite-list-jr

Repository files navigation

Build Status tested with jest npm version david.dm codecov

NPM

invite-list-jr

Find a list of customers who are close to the proximity (in KM). Mainly used to create a invitation list of customers within a certain radius of the event.

Setup

[sudo] npm i -g invite-list-jr

Usage

The program expects 2 inputs while looking for the right information:

  • Customer records in a text file (customers.txt) -- one customer per line, JSON-encoded. Example here.
  • config.json file, with the structure and information here.

Once you have the above information, run the following command:

invite-list-jr --f=[location to customers.txt] --c=[location to config.json]

This will give you a list of customers within in the proximity defined and number of results.

image

For easiness, we have provided a customers.txt and config.json example to get started with.

Calculation

Currently the program uses haversine function to calculate the distance and convert it to KM's. That said, we have an option to change the program to use spherical law of cosines here.

For more information regarding the algorithms, please refer to https://en.wikipedia.org/wiki/Great-circle_distance.

Roadmap

  • Allow the algorithm to be configurable.
  • Ability to write the results to a file and convert it to .csv for easy export.

Development

git clone [email protected]:jeremyrajan/invite-list-jr.git
npm install
gulp # starts a watcher
npm test # to run the tests using jest

About

Find records within a radius(proximity) using haversine or spherical law of cosines

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published