简体   繁体   English

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

[英]Find distance between two points using MKMapKit

I'm attempting to find the euclidean distance in meters between two points on an MKMapView using iPhone OS 3.2. 我正在尝试使用iPhone OS 3.2在MKMapView上的两点之间找到以米为单位的欧几里得距离。 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: CLLocation有一种为您计算距离的方法:

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

API docs here . API文档在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM