JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q46643F
  • License ISC

Haversine query for mysql.

Package Exports

  • mysql-haversine

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mysql-haversine) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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)