Comments (7)
Hi,
For a little context, I do not work with python on a daily basis.
shapely seems to be a knowned library to handle, according to the README:
manipulation and analysis of planar geometric objects
With haversine, you try to manipulate latitude and longitude. As we might link x / y
to lat / lng
, I fear that it will lead to imprecision and possible bugs for users that not understand that x/y on a plan are not really the same as lat / lng.
It's not a hard no, but I would prefer understand your use case to implement this.
A possible workaround for you is to create an adapter in your code:
def point_to_tuple(p: Point) -> (number, number):
return (p.x, p.y)
from haversine.
Hi, can you provide an example of what you want exactly ?
Thanks
from haversine.
from haversine.
I was interested in this because I use the haversine library and shapely
no need to modify the library, just extract the point co-ordinates from the objects and calculate the haversine distance.
from haversine import haversine
from shapely.geometry import Point
lyon = (45.7597, 4.8422) # (lat, lon)
paris = (48.8567, 2.3508)
lyon_point = Point(lyon[1], lyon[0])
paris_point = Point(paris[1], paris[0])
lyon_coords = (lyon_point.y, lyon_point.x)
paris_coords = (paris_point.y, paris_point.x)
print(haversine(lyon_coords, paris_coords))
This returns 392.2172595594006
from haversine.
@hcm444 Doesn't the proposed adapter suits your need ?
from haversine.
@hcm444 Doesn't the proposed adapter suits your need ?
Yes sir, I guess we can close this issue, correct?
from haversine.
Yes, I'm closing this 👍
from haversine.
Related Issues (20)
- Reverse haversine HOT 2
- Add haversine cdist HOT 7
- Add "rad" and "deg" to Units HOT 4
- Haversine will not import with Ubuntu 20.04 and Python 3.8.2 HOT 2
- Pycharm report error "Import Unit fails" HOT 5
- Cannot pip install version 1.0.x with latest (56.2.0+) version of setuptools HOT 1
- No longer py2 compatible HOT 1
- Compute bearing / cardinal informations between two points HOT 10
- What does Unit.DEGREE option return in haversine function? HOT 4
- Unable to install with pyton 3.10 HOT 5
- haversine raises an exception above 180 degrees latitude HOT 13
- Examples on README.md are incorrect HOT 1
- `inverse_haversine` precision for cardinal directions HOT 14
- last release is breaking my CI HOT 8
- Officially support Python 3.10 on PyPI HOT 1
- haversine_vector is no longer fast HOT 3
- Typo in repository `About` HOT 1
- Possible vectorization bug HOT 3
- [tests] failures against 32bit arches HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haversine.