Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculate the distance between two points in iphone

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

like image 730
SEG Avatar asked Nov 21 '25 16:11

SEG


1 Answers

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.

like image 162
Sabby Avatar answered Nov 24 '25 07:11

Sabby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!