百度地图计算经纬度2点之间的距离

    //获得当前位置和指定位置之间的距离   

    BMKMapPoint point1 = BMKMapPointForCoordinate(CLLocationCoordinate2DMake(39.915,116.404));
    BMKMapPoint point2 = BMKMapPointForCoordinate(CLLocationCoordinate2DMake(38.915,115.404));
    CLLocationDistance distance = BMKMetersBetweenMapPoints(point1,point2);

    NSLog(@" 距离为%@ ",[NSString stringWithFormat:@"%0.2f公里",distance/1000]);

posted @ 2016-02-17 16:34  有梦想的人,不睡觉  阅读(769)  评论(0编辑  收藏  举报