如何计算两点经纬之间的距离? [英] How do I calculate the distance between two points of latitude and longitude?
本文介绍了如何计算两点经纬之间的距离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
我有一个特定地方的纬度和经度,我想计算距离$ p> CLLocation * location1 = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1];
CLLocation * location2 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2];
NSLog(@Distance i meters:%f,[location1 distanceFromLocation:location2]);
[location1 release];
[location2 release];
您还需要添加 CoreLocation.framework
到你的项目,并添加import语句:
#import< CoreLocation / CoreLocation.h>
i have latitude and longitude of particular place and i want to calculate the distance so how can i calculate it?
解决方案
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2];
NSLog(@"Distance i meters: %f", [location1 distanceFromLocation:location2]);
[location1 release];
[location2 release];
You also need to add CoreLocation.framework
to your project, and add the import statement:
#import <CoreLocation/CoreLocation.h>
这篇关于如何计算两点经纬之间的距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文