0

I need to calculate the distance between the current location(by getting latitude,longitude from GPS) and designation (mecca[mosque]) which is fixed. Please anyone guide me.

-Thanks in Advance.

Praveen S
  • 10,355
  • 2
  • 43
  • 69
adhees
  • 79
  • 2
  • 5

2 Answers2

2

Make use of

 [location1 distanceFromLocation:location2];

In your case

[currentLocation distanceFromLocation:meccaLocation];

Note that this returns the distance in CLLocationDistance

visakh7
  • 26,380
  • 8
  • 55
  • 69
0

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

Excellent coverage of the subject.

Additional details are in Bowditch's American Practical Navigator.

And it may help to know this: 21° 25' 36" N / 39° 49' 34" E

S.Lott
  • 384,516
  • 81
  • 508
  • 779
  • +1 for a great link. Also, if you need to know the distance with an accuracy better than 0.5%, there's this: http://en.wikipedia.org/wiki/Vincenty%27s_formulae – JeremyP May 04 '11 at 10:05
  • And your latitude is off. http://toolserver.org/~geohack/geohack.php?pagename=Kaaba&params=21_25_21_N_39_49_34_E_type:landmark_scale:2000 – JeremyP May 04 '11 at 10:10