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.
datasette 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).
Demo
You can try this function here using Datasette Lite.
select haversine(
40.7128, -74.0060, -- New York
37.7749, -122.4194, -- San Francisco
'mi'
) as distance_in_miles;
Custom units
By default haversine() returns results in km. You can pass an optional third argument to get results in a different unit:
ftfor feetmfor metersinfor inchesmifor milesnmifor nautical mileskmfor kilometers (the default)
select haversine(lat1, lon1, lat2, lon2, 'mi');
Metadata
Release files for datasette-haversine 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datasette-haversine-0.2.1.tar.gz | 6.8 kB | Without provenance | Details for datasette-haversine-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datasette_haversine-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for datasette_haversine-0.2.1-py3-none-any.whl |
Total release size: 13.6 kB
Release files / datasette-haversine-0.2.1.tar.gz
| Download URL | datasette-haversine-0.2.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7405fcb2aa6ca5c6c256ce34c96994d432259203af9fcd1a7b96534221d0357f
|
|
BLAKE2b-256 checksum How to use checksums |
af403ce30a6fe1d9b9df5c6a96d72f705514f392daf38318822c6f9beffba31c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / datasette_haversine-0.2.1-py3-none-any.whl
| Download URL | datasette_haversine-0.2.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fd80f488d44cad5a868170f2db1b93c3b26d556ae70f9c690152b97a6bdd52c
|
|
BLAKE2b-256 checksum How to use checksums |
46f725a19af39c1a4e7827e316f41fae66b07352473be1b702844bdb7a4209f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for datasette-haversine 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.