Patrick Kelly
Posts: 0
Joined: Wed Nov 20, 2013 6:00 am

How can I get directions from the address already defined in the map app to the location in the input field?

Basically, this is a case of basic programming memory loss. In the code below, I simply need to know how I can use the address that is already in the map (the one you define in the map settings and/or the one currently displayed on the map) instead of the information from the inputSource field. Something to the effect of var source Address = get.geocode("Address").val();

var sourceAddress = Appery("inputSource").val();
var destinationAddress = Appery("inputDestination").val();
var map = Appery("directionsMap").gmap;
displayDirections(sourceAddress, destinationAddress, map);

Patrick Kelly
Posts: 0
Joined: Wed Nov 20, 2013 6:00 am

How can I get directions from the address already defined in the map app to the location in the input field?

Yeah, I've seen those and I have been looking through the documentation, but I am still a little rusty on my java programming classes that I took in college a couple years ago. I've just been having trouble finding out how to make it happen. Basically, I just need to know how to call the current address in the map so that I can put it into a variable when I click a button.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How can I get directions from the address already defined in the map app to the location in the input field?

If you use example from this tutorial than you need to add next steps:

  • Open directions.js;

    Add following lines:
    pre
    var route = response.routes[0];
    for (var i = 0; i < route&#46;legs&#46;length; i++) {
    localStorage&#46;setItem("startaddr", route&#46;legs&#46;start_address);
    localStorage&#46;setItem("endaddr", route&#46;legs&#46;end_address);
    }
    /pre

    after existing line:

    pre
    if (status == google&#46;maps&#46;DirectionsStatus&#46;OK) {
    directionsDisplay&#46;setDirections(response);
    /pre

  • Add event on "Get Directions" button click like on screen shot:

    Image

    This Link will be useful: https://google-developers.appspot.com...

Return to “Issues”