Page 3 of 8

Geolocation Tracking App

Posted: Thu Apr 04, 2013 9:24 pm
by Maryna Brodina

You call method route, but the object is not defined. The error occurs because you didn't initialize variables with your function initialize (you don't call this function)


Geolocation Tracking App

Posted: Fri Apr 05, 2013 12:01 am
by Joe Paisley

I'm sorry I don't understand. I thought I did. This is on my javascript page:
codevar bikeLayer, directionDisplay, directionsService;
function initialize() {
bikeLayer = new google.maps.BicyclingLayer('directionsMap');
bikeLayer.setMap(Tiggzi('directionsMap').gmap);
directionDisplay;
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
}

function displayDirections(sourceAddress, destinationAddress, map, panel) {
var request = {
origin: sourceAddress,
destination: destinationAddress,
travelMode: google.maps.DirectionsTravelMode.BICYCLING,
avoidHighways: true
};

directionsService.route(request, function(response, status) {
if (panel != null) {
directionsDisplay.setPanel(panel);
}
directionsDisplay.setMap(map);

if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
alert("Directions query unsuccessful. Response status: " + status);
}
});
}
google_ad_client = "ca-pub-8264282481974683&quot
/* Mobile Ad */
google_ad_slot = "5144076950&quot
google_ad_width = 320;
google_ad_height = 50;/code

with this :
codeinitialize();/code

and this on load:
code var bikeLayer, directionDisplay, directionsService, directionsDisplay;
function initialize() {
bikeLayer = new google.maps.BicyclingLayer('directionsMap');
bikeLayer.setMap(Tiggzi('directionsMap').gmap);
directionDisplay;
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
} /code
And this on click event for the "Get Directions" button:
code
var sourceAddress = Tiggzi("inputSource").val(null);
var destinationAddress = Tiggzi("inputDestination").val(null);
var map = Tiggzi("directionsMap").gmap;

displayDirections(sourceAddress, destinationAddress, map);
/code

I tried to follow this tutorial as best as I could: http://docs.tiggzi.com/tutorials/buil...

Where did I go wrong? Thanks for the help.


Geolocation Tracking App

Posted: Fri Apr 05, 2013 9:10 am
by Kateryna Grynko

Hi Joe,

Sorry for the delay. There is an error in JS:
You use two variables: directionDisplay и directionsDisplay (litter 's' differs).

You have an extra line:
codedirectionDisplay;/codeYou can delete it.

On "Map" page there is Run JavaScript action where you duplicate function initialize(). You shouldn't do that because initialize() function is defined in JS asset.


Geolocation Tracking App

Posted: Fri Apr 05, 2013 10:24 am
by Joe Paisley

As it stands now, my javascript1 reads:
codevar bikeLayer, directionsDisplay, directionsService;
function initialize() {
bikeLayer = new google.maps.BicyclingLayer('directionsMap');
bikeLayer.setMap(Tiggzi('directionsMap').gmap);
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
}

function displayDirections(sourceAddress, destinationAddress, map, panel) {
var request = {
origin: sourceAddress,
destination: destinationAddress,
travelMode: google.maps.DirectionsTravelMode.BICYCLING,
avoidHighways: true
};

directionsService.route(request, function(response, status) {
if (panel != null) {
directionsDisplay.setPanel(panel);
}
directionsDisplay.setMap(map);

if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
alert("Directions query unsuccessful. Response status: " + status);
}
});
}
google_ad_client = "ca-pub-8264282481974683&quot
/* Mobile Ad */
google_ad_slot = "5144076950&quot
google_ad_width = 320;
google_ad_height = 50;/code

And I removed the initialize () function from the "events" on the page as it is in "javascript1." All that happens now is the source and destination disappear, but no map route is rendered, nor is there a route turn-by-turn list.


Geolocation Tracking App

Posted: Fri Apr 05, 2013 9:17 pm
by Maryna Brodina

Sorry, no updates yet, but we'll continue working on it and I'll let you know about the results.


Geolocation Tracking App

Posted: Mon Apr 08, 2013 3:13 pm
by Kateryna Grynko

Hi Joe,

To make Get Directions button display the route on map you would need to correct Run JavaScript action added to this button.

In the following lines there is an extra "null":
codevar sourceAddress = Tiggzi("inputSource").val(null);
var destinationAddress = Tiggzi("inputDestination").val(null);/code
There should be:
codevar sourceAddress = Tiggzi("inputSource").val();
var destinationAddress = Tiggzi("inputDestination").val();/code


Geolocation Tracking App

Posted: Thu Apr 11, 2013 3:03 pm
by Joe Paisley

I've changed the button click event javascript to say the code var sourceAddress = Tiggzi("inputSource").val();
var destinationAddress = Tiggzi("inputDestination").val();/code
And it still doesn't work. I get this error still: Image


Geolocation Tracking App

Posted: Thu Apr 11, 2013 3:33 pm
by Maryna Brodina

Hi, we'll take a look.


Geolocation Tracking App

Posted: Thu Apr 11, 2013 5:00 pm
by Maryna Brodina

To get "Get Directions" button working on page Map on Load event add the following:

codeinitialize();/code


Geolocation Tracking App

Posted: Thu Apr 11, 2013 5:19 pm
by Joe Paisley

Now that I've done that, the page has a lot of trouble loading. Also, on the "website" page the "map ride" button doesn't work sometimes.