Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate walking directions with Maps app iOS

As of now, I successfully generate directions with Maps app from my app with the following code :

NSString *formattedGroceryAddress = [[NSString stringWithFormat:@"%@",((EnhancedUIActionSheet *)actionSheet).grocery.address] stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *routeString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",localDataHelper.userLocation.coordinate.latitude,localDataHelper.userLocation.coordinate.longitude,formattedGroceryAddress];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:routeString]];

It opens the Maps app with the appropriate driving directions. The thing is, I'd like to open Maps with the walking directions by default. Maybe I can pass another parameter in my request to do that.

Anybody knows how ?

Thanks !

like image 937
Johanisma Avatar asked Jan 05 '11 21:01

Johanisma


People also ask

Can I plot a walking route on Apple Maps?

For turn-by-turn directions with CarPlay, select the Apple Maps driving directions travel mode. To use walking directions, select the Apple Maps walking travel mode. For bike directions, select the Apple Maps bicycling travel mode.

Is there an app that creates a walking route?

There are several apps like Google Maps, Footpath, and MapMyWalk that you can use to map a walking route on your iPhone. With these apps, you can plan routes ahead of time.


1 Answers

Well I guess I should have searched better before asking !

You can add dirflg=w to the request and it will launch maps app in the walking mode.

It's funny because Apple says they are only supporting a few Google Maps parameters not including this one but it actually seems to work !

For more info on Google Maps parameters : http://mapki.com/wiki/Google_Map_Parameters
For more info on Maps links from iOS apps : http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html

like image 178
Johanisma Avatar answered Oct 23 '22 11:10

Johanisma