开发者

Find distance between two points using MKMapKit

开发者 https://www.devze.com 2023-01-03 17:17 出处:网络
I\'m attempting to find the euclidean distance in meters between two points on an MKMapView using iPhone 开发者_StackOverflow社区OS 3.2. The problem is that I have these coordinates in terms of latitu

I'm attempting to find the euclidean distance in meters between two points on an MKMapView using iPhone 开发者_StackOverflow社区OS 3.2. The problem is that I have these coordinates in terms of latitude and longitude, which, mathematically provides me enough data to find the distance, but it's going to take some tricky trigonometry. Is there any simpler solution?

Thanks!


CLLocation has a method to calculate the distance for you:

- (CLLocationDistance)distanceFromLocation:(const CLLocation *)location

API docs here.

0

精彩评论

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