iphone google maps - direction using latitude and longitude

10,576

Solution 1

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]];

Solution 2

Rob is right.

You can do something like below, just providing the Destination ( or start address )

http://maps.google.com/maps?daddr=-37.8218956215849,144.9599325656891

Or even

http://maps.google.com/maps?saddr=-37.8218956215849,144.9599325656891&daddr=-37.8218956215849,144.9599325656891

It's just replacing start & end with the lat/langs.

http://maps.google.com/maps?saddr=start&daddr=end

Share:
10,576
Satyam
Author by

Satyam

I'm an iOS Applications Architect.

Updated on June 16, 2022

Comments

  • Satyam
    Satyam almost 2 years

    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?