开发者

Calculate compass heading to a CLLocation - Haversine functions for iOS

开发者 https://www.devze.com 2023-01-06 13:33 出处:网络
I understand how to get the distance between 2 CLLocations. I need to determine the generalized compass bearing (N, NE, E etc.) from a CLLocation to another CLLocation.

I understand how to get the distance between 2 CLLocations. I need to determine the generalized compass bearing (N, NE, E etc.) from a CLLocation to another CLLocation.

Before I implement something to derive the bearing with the haversine formula is there a generally adapted open source library or code fragment that you've found solves this problem with开发者_如何学Python or without using haversine?

Thanks!


I've used some of the snippets available from Movable Type Scripts - both haversine and spherical law of cosines available. The code examples are all in JavaScript, but they translate very easily to C or Objective C.


Check out https://github.com/100grams/CoreLocationUtils

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号