今天做了一些涉及到地图的东西,遇到了计算两个坐标点的需求,查了下资料做了出来,这里把做法写下来,一方面加深印象,另一方面也希望可以帮到更多人。
闲话少说,直接上代码:
CLLocationCoordinate2D coor[2] = {
0};
coor[0].latitude = [send_ltd doubleValue];
coor[0].longitude = [send_lgd doubleValue];
coor[1].latitude = [receive_ltd doubleValue];
coor[1].longitude = [receive_lgd doubleValue];
CLLocation *send = [[CLLocation alloc]initWithLatitude:coor[