views:

374

answers:

2

I'm working on iphone app. I know my current location (latitude and longitude) and destination's (latitude and longitude). How can I use "Google maps" to find the directions. URL for google maps is something like "http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino"
From above URL, inspite of source and destination places i want to use latitude and longitude. how?

A: 

Have you tried just sticking the Latitude and Longitude in as the parameters? In my experience Google APIs are pretty loose on what you can put into them. The Google Local API can take almost anything including lat lng as a query for example.

Rob Stevenson-Leggett
+3  A: 
NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",
                                            currentLocation.coordinate.latitude, currentLocation.coordinate.longitude, 
                                            destLocation.coordinate.latitude, destLocation.coordinate.longitude];

[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
s1mm0t
Thanks a lot, it worked
Satyam svv
hey thanks it worked fr me also
SWATI