mysql-haversine

1.2.1 • Public • Published

mysql-haversine

Mysql haversine query generator.

Install

npm install mysql-haversine

Basic usage

Given your coordinates it compares the circular distance from you with each coordinate in the given database table.

var mysqlHaversine = require('mysql-haversine');

var query = mysqlHaversine.query(100, 'stores', 18.370531, -66.143399, 'ASC');

API

query(distance, table_name, your_latitude, your_longitude, order_by)

It compares the circular distance from your coordinates with each coordinate in the given db table. It only returns the results of the ones that are less than or equal to the given distance(km) and orders them ascending(ASC) or descending(DESC).

distance = max radius to query of the circle around your coordinate(km)
table_name = name of the the database table
your_latitude = your current latitude
your_longitude your current longitude
order_by = how you want to order the results(ASC or DESC)

Readme

Keywords

Package Sidebar

Install

npm i mysql-haversine

Weekly Downloads

14

Version

1.2.1

License

ISC

Last publish

Collaborators

  • jonatns