Datasette plugin that adds a custom SQL function for haversine distances
Project description
datasette-haversine
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 feetm
for metersin
for inchesmi
for milesnmi
for nautical mileskm
for kilometers (the default)
select haversine(lat1, lon1, lat2, lon2, 'mi');
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for datasette_haversine-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2185a14d87e353d6afaf02450dfb87df27cd2b0d24e3aa25686a6571e16aa4c |
|
MD5 | 12ddca14b40150bf510d5c15b7f33875 |
|
BLAKE2b-256 | 7bcf1a80bf2b79011b6c97ab7dd2da949eb946060fea63b90006c4022f5d6875 |