Find distance between two points using MKMapKit

一笑奈何 提交于 2019-12-11 06:46:48

问题


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?

Thanks!


回答1:


CLLocation has a method to calculate the distance for you:

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

API docs here.



来源:https://stackoverflow.com/questions/3065967/find-distance-between-two-points-using-mkmapkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!