Ninja Pirate Mutants

    distance-finder-by-geo

    1.2.6 • Public • Published

    DistanceFinderByGeo

    Library to find data which falls under a given radius (km). The library uses Geopoint calculations using Radians to get distance between two coordinates and then find out which data falls under the given radius.

    Install

    npm install distance-finder-by-geo

    Usage

    require('distance-finder-by-geo')

    Download Sample Customers.txt file for testing

    Click to Download the file

    Functions

    Get All the Customers within Radius Range provided at the time of function call.

    getAllCustomersWithinRange(point, jsonFilePath, radius, orderBy = '')

    Paramaters:

    • point: The base Geopoint from where we need to find distance of other Coordinates
    • jsonFilePath: Customers.txt file path which has the Coordinates data
    • radius: The distance radius
    • orderBy: (Optional) Pass the field name exist in Customers.txt file by which you want the Ascending Ordering
    // Working code sample
    require('distance-finder-by-geo')
      .getAllCustomersWithinRange({ lat: 53.339428, lng: -6.257664 }, __dirname + '/Customers.txt', 100, 'user_id')
      .then(result => {
        console.log(result);
      }).catch(ex => {
        console.log(ex);
      })

    Get all the data in Success Callback and Exception in Error Callback.

    Keywords

    none

    Install

    npm i distance-finder-by-geo

    DownloadsWeekly Downloads

    2

    Version

    1.2.6

    License

    MIT

    Unpacked Size

    16.1 kB

    Total Files

    18

    Last publish

    Collaborators

    • jimcute