tags:

views:

33

answers:

1

Hello how can an iphone user find the distance on roads between two locations using an in app solution preferably using two text fields?

I tried google maps. However, I'm not sure if there is a mapkit tool to do this build in or a google maps api?

I am trying to use this value in order to do some calculations afterwards.

A: 

The way I did it was to get the two locations and call the mapquest API to calculate the distance.

Read here: http://developer.mapquest.com/web/products/dev-services/directions-ws

My API URL is something like this:

http://www.mapquestapi.com/directions/v1/routematrix?allToAll=false&ambiguities=ignore&inFormat=xml&outFormat=xml&xml=<route><locations><location>location_one</location><location>location_two</location></locations></route>&key=your_key

Then you parse the XML and get the answer!

Ben