Seafarer ⛵
Taxicab metric on the sphere! Install via
pip install seafarer
This library calculates the "seafarer distance" between two points on Earth: Travel parallel to latitude and longitude instead of "as the crow flies" – like in the old days...
Usage
Calculate the distance between Schwerin and Helsinki:
from seafarer import seafarer_metric
schwerin = (53.629722, 11.414722) # (lat, lon)
helsinki = (60.170278, 24.952222)
seafarer_metric(schwerin, helsinki)
# 1474.7398906623202 kilometres
You can also obtain the result in different units:
seafarer_metric(schwerin, helsinki, unit="mi")
# 916.3608837507956 miles
seafarer_metric(schwerin, helsinki, unit="ft")
# 4838385.468052049 feet
Seafarer is using the haversine library
under the hood and you can use their Unit directly:
from haversine import Unit
seafarer_metric(schwerin, helsinki, unit=Unit.NAUTICAL_MILES)
# 796.2958366185961 nautical miles
What is this? Why Seafarer?
On a 2-dimensional plane, the metric obtained when travelling along the axes is known as taxicab, Manhattan, or L1 metric. What is the equivalent on a 3-dimensional sphere?
We calculate the distance when travelling along the grid of longitudinal and latitudinal lines. When travelling from Schwerin (53°N 11°E) to Helsinki (60°N 24°E) in the example above, there are two possiblities: travel via 53°N 24°E or 60°N 11°E. Unlike the 2D case, these two distances are (generally) different, so we use the short one.
Before navigation improved to a sufficient degree, this is how ships were sailing: parallel to the equator until they hit the target meridian, then North or South to their final destination. Hence seafarer metric! ⛵
Metadata
Release files for seafarer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| seafarer-0.1.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seafarer-0.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / seafarer-0.1.0.tar.gz
| Download URL | seafarer-0.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
752c42c7b6ccb72feb7867763551d60c04a6d0de3fbea486a981438cf41bb756
|
|
BLAKE2b-256 checksum How to use checksums |
c74f04f4d3d8ca19e892154c6b493ef11e6ebbac4766c87c0d6a5902454832a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|
Release files / seafarer-0.1.0-py2.py3-none-any.whl
| Download URL | seafarer-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ae994cced915d556a5ec3432fa5e503a03d4d5f42e2353200367ba25b98fb317
|
|
BLAKE2b-256 checksum How to use checksums |
6f72e05e05df7cf2df01676f6ee8f8d33e8d89aece2a60b442ad36eae1869132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|