如何计算百度地图上两点的距离

2025-04-04 18:38:57
推荐回答(1个)
回答1:

百度地图中计算两点之间距离的方法

BMKMapPoint point1 = BMKMapPointForCoordinate(CLLocationCoordinate2DMake(38.085178, 114.502358));
BMKMapPoint point2 = BMKMapPointForCoordinate(CLLocationCoordinate2DMake(38.085171, 114.502312));
CLLocationDistance distance = BMKMetersBetweenMapPoints(point1,point2);

NSLog(@"距离: %0.2f米", distance);