iPhone: Navigate to address
Hello,
I am creating an app for a shop, and I'm having this "Profile" tab showing their location on a map. I would like to create a button, entitled "Navigate to", which I want to open up the Maps application and start navigating to their address. Is this possible? If so, what is the code for opening up Maps and starting the navigation?
Caspar
1 Answer
-
Accepted Answer
Not that its perfect, but I use the following. You have to supply your starting location as the current gps coordinates.
var mapUrl = 'http://maps.google.com/maps?'; if (latitude && longitude) { mapUrl += 'saddr=' + latitude + ',' + longitude + '&'; } var daddr = destination.Address + ', ' + destination.City + ' ' + destination.State + ' ' + destination.Zipcode; mapUrl += 'daddr=' + daddr.replace(' ','+'); Titanium.Platform.openURL(mapUrl);