0

hello i want distance between two place ... means i have two places latitude and longitude then i want distance between that two place

i want something like this...

http://maps.google.com/maps?saddr=23.029772,72.527871&daddr=23.1901748,72.0127743

not like php or .net or java function that give calculate distance ...

if i search result by function it give me 55.61 output for this latitude and logitude and in map it give me 65.5 output. how can i get this in json ot xml or any other formate ?

Kirby Todd
  • 11,254
  • 3
  • 32
  • 60
  • possible duplicate of [How do I calculate distance between two latitude longitude points?](http://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points) – Daniel A. White Mar 26 '11 at 13:05
  • The function is returning based of as "the bird flies" - a straight shot. The map is calculating on roads. – Daniel A. White Mar 26 '11 at 13:07
  • @daniel - i alredy seen that question . that give me distace output of this location 55.61 . i dont want that .i want distance by roads. how can i get this ? –  Mar 26 '11 at 13:22

1 Answers1

1

...there's an in-built function in iOS that will do this for you. Check out the CLLocation documentation. Particularly distanceFromLocation:, which as the name suggests returns the difference between two locations in meters. You can create a CLLocation object using lat and lon.

If you don't want a straight line distance, you need to use the Google Directions API, which is well documented here: http://code.google.com/apis/maps/documentation/directions/

lxt
  • 31,146
  • 5
  • 78
  • 83
  • is this give me distance in road ? like i http://maps.google.com/maps?saddr=23.029772,72.527871&daddr=23.1901748,72.0127743 ?or what ? –  Mar 26 '11 at 13:44