Iphone – Calculate the distance between two points in iphone

distancegoogle mapsiphonexcode

I am creating an application that requires the user to input two places (Postal codes). My application will calculate the driving-distance between these two points ad output the result. The user has the option of adding Way-Points.
I think I would have to use the google maps API and get an xml file with the result and then parse the xml file. Can anyone help me because i not sure how to do this.
Appreciate all help.

Example…
Start: BR1 1LR

Waypoint: BR2 0LH

Waypoint: BR3 4AY

Destination: BR1 1LR

Best Answer

Yes you can calculate the distance ,for that you need to have the latitude and longitude to get the distance.Objective C provides the method to calculate the distance between points here is the example......

float distance =[mUserCurrentLocation distanceFromLocation:location1]/1000;

This will provide you the distance in Kilometers.

Related Topic