IOS计算两点之间的距离

 1 //广州经纬度
 2 CLLocationCoordinate2D guangZhouLocation;
 3 guangZhouLocation.latitude = 23.20;
 4 guangZhouLocation.longitude = 113.30;
 5 BMKMapPoint guangZhou = BMKMapPointForCoordinate(guangZhouLocation);
 6 
 7 //深圳经纬度
 8 CLLocationCoordinate2D shenZhenLocation;
 9 shenZhenLocation.latitude = 22.33;
10 shenZhenLocation.longitude = 114.07;
11 BMKMapPoint shenZhen = BMKMapPointForCoordinate(shenZhenLocation);
12 
  //计算广州与深圳的距离
13
CLLocationDistance distance = BMKMetersBetweenMapPoints(guangZhou,shenZhen); 14 NSLog(@"距离:%f",distance);

 

posted @ 2013-09-18 00:03  wangzhenxiang  阅读(780)  评论(0编辑  收藏  举报