Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Google Maps from iPhone and show route

Tags:

iphone

I was wondering how I can open Google Maps from my iphone app so that Google Maps shows the route when you arrive at the web page?

Today I use code that only shows the coordinate.

        NSString *latlong = [NSString stringWithString: @"59.33267,18.07361"];
        NSURL *url = [[[NSURL alloc] initWithString:[NSString stringWithFormat: @"http://maps.google.com/maps?ll=%@", [latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ]] autorelease];
        [[UIApplication sharedApplication] openURL:url];
like image 924
Fernando Redondo Avatar asked Sep 21 '10 13:09

Fernando Redondo


People also ask

Can you preview a route on Google Maps?

Important: You can't start navigation if you don't use your current location, but you can still get a preview of the route. Search for your destination or tap it on the map.

Can you see your route on iPhone?

While following driving, cycling, and walking directions in the Maps app , you can get an overview of your route and a list of upcoming turns.


1 Answers

Use the following format for url (you must specify both route start and endpoint):

"http://maps.google.com/maps?daddr=%f,%f&saddr=%f,%f"
like image 60
Vladimir Avatar answered Nov 16 '22 01:11

Vladimir