https://github.com/ipdata/cyvincenty
https://github.com/ipdata/cyvincenty
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ipdata/cyvincenty
- Owner: ipdata
- License: mit
- Created: 2022-06-16T18:43:04.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-17T10:07:41.000Z (almost 4 years ago)
- Last Synced: 2026-01-07T21:39:12.512Z (4 months ago)
- Language: Cython
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cyvincenty
A fast Cython implementation of the Vincenty algorithm for calculating the distance in kilometers between 2 co-ordinates.
This module is heavily inspired by [uvincenty](https://github.com/vivescere/uvincenty) and [vincenty](https://github.com/maurycyp/vincenty). It is just as fast if not slightly faster than uvincenty which is a pure C Python extension despite being written in Python! (technically Cython).
## Installation
```bash
pip install cyvincenty
```
## Usage
```python
>> from cyvincenty import vincenty
>> boston = (42.3541165, -71.0693514)
>> newyork = (40.7791472, -73.9680804)
>> vincenty(*boston, *newyork)
```
## Benchmarks
Using ipython
```python
>> import cyvincenty
>> import uvincenty
>> import vincenty
>> import geopy.distance
>> boston = (42.3541165, -71.0693514)
>> newyork = (40.7791472, -73.9680804)
>> %timeit uvincenty.vincenty(*boston, *newyork)
744 ns ± 2.58 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
>> %timeit cyvincenty.vincenty(*boston, *newyork)
736 ns ± 2.82 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
>> %timeit vincenty.vincenty(boston, newyork)
10.2 µs ± 60.1 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
>> %timeit geopy.distance.geodesic(boston, newyork)
191 µs ± 1.52 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
```