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
I know this is really late, but I’m posting my solution to this in case anybody needs it.
Firstly, i declared the URL (the one that calls google maps api)
Next I created a string containing this URL:
Where source, destination are strings containing the start point and end point. units can be @”imperial” or @”metric”.
Now that i had the URL, i would get back an xml string. To parse this, i used TBXML. There is always a large debate about which XML Parser to use. I used TBXML as it was easy, and is the fastest.
Once checking the root status is OK, then obtain the result for the XPath expression: //row/element/distance/value
If anyone wants to have a URL to include way points, then here it is
But to use way points, things work a bit differently as Jano pointed out.