Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-08-2009, 05:35 AM   #10 (permalink)
n8r0n
Registered Member
 
Join Date: Jun 2009
Posts: 7
Default Opening the maps app with a given route/direction

You can do this by obtaining the latitude and longitude from CoreLocation, and then passing that into the maps URL. You can mix and match lat/lon and street addresses, which is what I do:

Code:
        CLLocationCoordinate2D currentLocation = [self getCurrentLocation];
        NSString* address = @"123 Main St., New York, NY, 10001";
        NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",
                         currentLocation.latitude, currentLocation.longitude,
                         [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
This works on my iPhone (2.2.1), and I didn't need to add any dummy parameters to the URL. Just saddr (lat/lon) and daddr (address).
n8r0n is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,871
Threads: 89,225
Posts: 380,695
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Darmanikles
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.