- (double)calculateStart:(CLLocationCoordinate2D)start end:(CLLocationCoordinate2D)end { double meter = ; double startLongitude = start.longitude;
double startLatitude = start.latitude;
double endLongitude = end.longitude;
double endLatitude = end.latitude; double radLatitude1 = startLatitude * M_PI / 180.0;
double radLatitude2 = endLatitude * M_PI / 180.0;
double a = fabs(radLatitude1 - radLatitude2);
double b = fabs(startLongitude * M_PI / 180.0 - endLongitude * M_PI / 180.0); double s = * asin(sqrt(pow(sin(a/),) + cos(radLatitude1) * cos(radLatitude2) * pow(sin(b/),)));
s = s * EARTH_RADIUS; meter = round(s * ) / ; //返回距离单位是米
return meter;
}
//赤道半径
EARTH_RADIUS = 6378137;
//start 起点经纬度,数据格式 start = {lon:,lat:}
//end 终点定位度,数据格式 end = {lon:,lat:}