1.0.2 • Published 5 years ago

searchmoduleb2c v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

searchmoduleb2c

A fast and simple geographical distance calculator for a set of lat, long with respsect to a central location (lat,long) and return user_id and names within the range of a specific distance.

Installation

Install using npm:

$ npm install searchmoduleb2c

Example

To get the distance between central location and every location in the data set, pass in the coordinates in decimal format.

let returnArr = '{"latitude": "53.74452", "user_id": 29, "name": "Oliver Ahearn", longitude": "-7.11167"}\r', '{"latitude": "53.761389", "user_id": 30, "name": "Nick Enright", "longitude": "-7.2875"}\r', '{"latitude": "54.080556", "user_id": 23, "name": "Eoin Gallagher", "longitude": "-6.361944"}\r', '{"latitude": "52.833502", "user_id": 25, "name": "David Behan", "longitude": "-8.522366"}' ; let centralLocLatLon = { lat: 53.339428, lon: -6.257664 }; let SearchModule = require('searchmoduleb2c'); let limit = 100; //in km var response = JSON.parse(SearchModule.getEligibleCandidates(returnArr, centralLocLatLon, limit));

Returns for success

{'status' : true, 'msg': 'success', 'data': 'user_id':29, 'name':'Oliver Ahearn'}

Returns for failure

{'status' : false, 'msg': 'error message', 'data': null}

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago