This project uses the H3-js library to determine which drivers are within a certain proximity to a passenger based on their latitude and longitude. It leverages Uber's H3 geospatial indexing system to efficiently calculate and categorize drivers as potential or non-potential based on their distance from the passenger.
-
Clone the Repository:
git clone https://github.com/Nik-9649/h3-js-driver-matcher.git cd h3-js-driver-matcher
-
Install Dependencies:
Ensure you have Node.js installed, then install the required packages:
yarn install
To use this tool, simply define the passenger's and drivers' locations, and the script will categorize the drivers as either potential or non-potential based on their proximity to the passenger.
You can run the script using Node.js:
node index.js
or
yarn dev
- Resolution: The H3 resolution level used for indexing. Higher resolutions provide more granularity but may require more computation.
- kDistance: The radius of interest for potential drivers, defined in terms of H3 hexagons (1 = adjacent hexagons).
Both of these settings can be adjusted in the script:
const resolution = 9; // Define the H3 resolution
const kDistance = 1; // Define the radius of interest (1 = adjacent hexagons)
This project is licensed under the MIT License. See the LICENSE file for details.