Skip to main content

Datasette plugin that adds a custom SQL function for shortest haversine distances between a point and a path

Project description

datasette-haversine-point-path

PyPI Changelog Tests License

Datasette plugin that adds a custom SQL function for shortest haversine distances between a point and a path on a sphere

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

datasette install datasette-haversine-point-path

The plugin is built on top of the haversine library.

haversine_point_path() to calculate distances

select haversine_point_path(lat1, lon1, lat2, lon2, lat3, lon3);

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

Demo

No demo yet

Custom units

By default haversine_point_path() 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_point_path(lat1, lon1, lat2, lon2, 'mi');

Project details


Release history Release notifications | RSS feed

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.

Source Distribution

datasette-haversine-point-path-0.1.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page