百度地图计算经纬度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]);

你可能感兴趣的:(百度地图计算经纬度2点之间的距离)