Best method to display directions between two points on map.

You must Login before you can answer or comment on any questions.

Hi all, I know that there are several methods to display directions/route on map but can someone tell what is the best working method?. I've tried several ways for last 5 hours but couldn't succeeded yet. I think addRoute() is the best one but don't know how to get the set of points between two locations to plot the route, from the google map api. Any help is appreciated. Thanks.

— asked 9 months ago by Muhammad Qasim Khan
1 Comment
  • EDIT: Actually I have a directions button on a window which will show directions from user's current location to another location on the map. I am confused what should I do on the click of the button I've tried this:

    btn_direction.addEventListener('click',function(e)
        {
            var win_directions = Titanium.UI.createWindow({
                    title : 'Tab 1',
                    backgroundColor : '#fff',
                    navBarHidden:true
            });
            var webview=Ti.UI.createWebView({
                top:10,
                url:"http://maps.google.com/maps?saddr="+<start point here>+"&daddr="+<destination>
            });
            win_directions.add(webview)
            Ti.API.navGrp.open(win_directions)
        });
    This shows the direcitons but I can't get back to previous window as it doesn't have a back button although I opened in a webview inside a navigation group.

    The second way is to plot the route manually with the mpview.addRoute() function but I don't know how to get the lat/lon of the points for the route object.

    Stucked very hard here and totally depending on QA help so please tell me ASAP that how should I handle the click event for directions button. Many thanks in advance.

    — commented 9 months ago by Muhammad Qasim Khan

2 Answers

oh, I'm sorry - you're asking for getting the points from the google api... may this helps: link

— answered 9 months ago by Soeren Damrau
answer permalink
2 Comments
  • but keep in mind (if developing for iOS) - there are no more google maps in iOS6!

    — commented 9 months ago by Soeren Damrau

  • In this link only html_instructions and distance are extracted not the points of the directions. I want to get lat/lon of all the points from point A to point B so that I can pass it to addRoute() function. And what you meant by "there are no more google maps in iOS6!", would we will not be able to request google api through xhr?

    — commented 9 months ago by Muhammad Qasim Khan

Your Answer

Think you can help? Login to answer this question!