Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked July 27th 2010 by Caspar Jespersen
  • iphone
  • navigation
0 Comments

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);
    
    — answered July 27th 2010 by Mike Robinson
    permalink
    1 Comment
    • So I need Address AND City AND State AND Zipcode to do this?

      What if i just want to open using City and Zipcode? Is this possible?

      — commented November 17th 2012 by Michael Massalas
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.