Troy Cooper
Posts: 0
Joined: Wed Jun 05, 2013 8:39 pm

Setting permanent Google Maps destination while geolocation sets start point.

Hey. Is that the right link? I copied that one from the drop down, test box. That was the only place that i knew that had a public link...

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Setting permanent Google Maps destination while geolocation sets start point.

Hi Troy,

Yes, I can open it. We'll test.

Troy Cooper
Posts: 0
Joined: Wed Jun 05, 2013 8:39 pm

Setting permanent Google Maps destination while geolocation sets start point.

Thanks Katya! Does what I am trying to do with the map make sense?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Setting permanent Google Maps destination while geolocation sets start point.

Troy,

This will take some time. Working on it.

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

Setting permanent Google Maps destination while geolocation sets start point.

Hi Troy,

  1. Add "Invoke service" action on "Map" screen "Load" event.

  2. On "Map" screen "Data" - "Edit Mapping" add next JS.
    Image
    for latitude field:
    code
    localStorage.setItem('latitude',value);
    /code
    for longitude field:
    code
    localStorage.setItem('longitude',value);
    /code

  3. Remove all JS code from "Directions" file and add next JS code to file :
    code
    var directionDisplay;
    var directionsService = new google.maps.DirectionsService();

    function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer();
    }

    function displayDirections(sourceAddress,destinationAddress, map) {
    var request = {
    origin: sourceAddress,
    destination: destinationAddress,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(request, function(response, status) {
    directionsDisplay.setMap(map);
    if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setDirections(response);
    } else {
    alert("Directions query unsuccessful. Response status: " + status);
    }
    });
    }
    /code

  4. Add input field to "Map" screen it would be for destination address, set name to "destAddress"
    5 .On "GetDirections" button click remove old JS code and add new one:
    code
    var destinationAddress = Appery("destAddress").val();
    var long = localStorage.getItem('longitude');
    var latit= localStorage.getItem('latitude');
    var sourceAddress = new google.maps.LatLng(latit,long);
    var map = Appery("directionsMap").gmap;
    displayDirections(sourceAddress,destinationAddress,map);
    /code

  5. Fix "Googlemap" name to "directionsMap".

Troy Cooper
Posts: 0
Joined: Wed Jun 05, 2013 8:39 pm

Setting permanent Google Maps destination while geolocation sets start point.

Hello again,

Sorry this has been such a problem! I went to try it and I keep getting stuck where I am supposed to add the JS for latitude and longitude in step 2. I click on the green "Add JS" button but when I begin entering text it goes vertical and I can't see the "Save & Return" button any more.

Image

What do I do?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Setting permanent Google Maps destination while geolocation sets start point.

Do you type or copy and paste the code?

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

Setting permanent Google Maps destination while geolocation sets start point.

HI!

We'll research about it deeply, as a quick fix do next:

  1. Remove Success event;
  2. Remove Mapping arrows;
  3. Save project;
  4. Create mappings arrows;
  5. Add success event.

Return to “Issues”