Quote:
Originally Posted by Newbie09
Hello,
I'm new to iPhone dev and Obj C. I am looking for a way to find the distance between 2 cities/zips. Calculating the distance based on Longitude/Latitude does not seem right. Is there any other MAP API that is available in Iphone SDK?
I do not want to display MapView in my App. I just need to find the distance
Thanks
|
There is nothing in the SDK to convert a city or a zip to latitude/longitude, or to calculate distance between cities, zips, or locations.
You'll need your own database of cities or zip codes (eitehr online or stored in the app) to turn a city/zip into a lat/long. To get the distance between two nearby locations, you'll have to convert from lat/long to miles and then use the Pythagorean theorem - sqrt(dx*dx + dy*dy). You must convert to miles or km before you get the distance, because the number of miles in a degree differs based on location.
For points that are far apart (for example, LA to New York) you'll need to figure the great circle distance to account for the curve of the earth.