2011-05-04 104 views
0

我需要计算当前位置(通过获取GPS的纬度,经度)和指定(麦加[mosque])之间的距离。请任何人指导我。位置指针和距离计算

- 提前感谢。

+0

请查阅https://github.com/100grams/CoreLocationUtils – 100grams 2011-06-23 16:05:19

回答

0

http://www.movable-type.co.uk/scripts/latlong.html

该主题的优秀报道。

其他详细信息在Bowditch's American Practical Navigator

它可能有助于知道这一点:21°25' 36" N/39°49' 34" E

+0

为了一个很好的链接+1。此外,如果您需要以超过0.5%的准确度来了解距离,则可以这样:http://en.wikipedia.org/wiki/Vincenty%27s_formulae – JeremyP 2011-05-04 10:05:32

+0

您的纬度已经关闭。 http://toolserver.org/~geohack/geohack.php?pagename=Kaaba¶ms=21_25_21_N_39_49_34_E_type:landmark_scale:2000 – JeremyP 2011-05-04 10:10:32

2

利用

[location1 distanceFromLocation:location2]; 

在你的情况

[currentLocation distanceFromLocation:meccaLocation]; 

请注意,这将返回距离CLLocationDistance

+0

是的。你是对的。但是,我们如何才能使用GPS和Web服务来获取当前位置? – adhees 2011-05-04 10:14:50

+0

利用核心位置框架 – visakh7 2011-05-04 10:19:02

+0

检查http://stackoverflow.com/questions/5786762/current-location-without-using-gps – visakh7 2011-05-04 10:19:44