Skip to main content

Datasette plugin that adds a custom SQL function for haversine distances

Project description

datasette-haversine

PyPI CircleCI License

Datasette plugin that adds a custom SQL function for haversine distances

Install this plugin in the same environment as Datasette to enable the haversine() SQL function.

$ pip install datasette-haversine

The plugin is built on top of the haversine library.

haversine() to calculate distances

select haversine(lat1, lon1, lat2, lon2);

This will return the distance in kilometers between the point defined by (lat1, lon1) and the point defined by (lat2, lon2).

Custom units

By default haversine() returns results in km. You can pass an optional third argument to get results in a different unit:

  • ft for feet
  • m for meters
  • in for inches
  • mi for miles
  • nmi for nautical miles
  • km for kilometers (the default)
select haversine(lat1, lon1, lat2, lon2, 'mi');

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for datasette-haversine, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size datasette_haversine-0.1-py3-none-any.whl (6.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page