geopy icon indicating copy to clipboard operation
geopy copied to clipboard

add bearing function ?

Open vbx opened this issue 10 years ago • 6 comments

Hello, i need bearing function for my project with geopy. I have not found this code in your project Maybe for the next release ? bearing function : http://pastebin.com/JbhWKJ5m,

vbx avatar May 29 '15 09:05 vbx

@vbx feel free to open a pull request adding such a function.

ijl avatar Jun 09 '15 23:06 ijl

Is this something that would still be welcomed by maintainers? I'd love to be able to use this to get bearing from latitude/longitude.

YPCrumble avatar Oct 26 '21 15:10 YPCrumble

Hi, I also think this would be a great feature. It looks like you can use bearing (and origin and distance) to calculate a destination. https://geopy.readthedocs.io/en/stable/index.html?highlight=bearing#geopy.distance.Distance.destination.

So would be great if the inverse would be added, i.e. use origin and destination to calculate a bearing.

drpepper19 avatar Jun 23 '22 19:06 drpepper19

e.g. see here https://stackoverflow.com/questions/17624310/geopy-calculating-gps-heading-bearing for someone who wanted to do this sort of thing with geopy, but the answers point him to other packages.

One comment there reads "i'm confused... why doesn't geopy have a function for computing this in line with the vincenty function which computes distance? – Michael Oct 7, 2014 at 16:58" that comment has been upvoted 8 times, a lot for a niche area.

drpepper19 avatar Jun 23 '22 19:06 drpepper19

This should be "easy" to implement. geopy/distance.py is already pulling in geographiclib.geodesic and all the functionality is there. A regular user or maintainer for geopy should do this (i.e., not me!). I available if there are questions.

cffk avatar Jun 23 '22 22:06 cffk

Adding my support for this request. See my SO question and hacked together solution here: https://stackoverflow.com/questions/75564161/calculating-points-along-a-line-between-two-points-using-geopy/75600705#75600705

It's weird that geopy:

  • does support calculating the distance between a start point and and end point
  • does support calculating the location of an end point when given a start point, a distance and a bearing
  • does not support calculating the bearing when given the start point and an end point

hankhank10 avatar Mar 01 '23 07:03 hankhank10