使用MKMapKit查找两点之间的距离

时间:2022-06-24 14:33:11

I'm attempting to find the euclidean distance in meters between two points on an MKMapView using iPhone 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?

我试图使用iPhone OS 3.2在MKMapView上找到两点之间的欧氏距离。问题是我在纬度和经度方面有这些坐标,在数学上为我提供了足够的数据来找到距离,但它需要一些棘手的三角函数。有没有更简单的解决方案?

Thanks!

1 个解决方案

#1


7  

CLLocation has a method to calculate the distance for you:

CLLocation有一种方法来为你计算距离:

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

API docs here.

API文档在这里。

#1


7  

CLLocation has a method to calculate the distance for you:

CLLocation有一种方法来为你计算距离:

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

API docs here.

API文档在这里。