Page 1 of 1

Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 8:03 am
by Jeff W

I'm completely stumped on this one, and we really need to get around this issue in order for our team to make progress and demo our app in the morning.

I have a page that contain nothing other than a Google Map control (and the accompanying marker). Whenever I try to boot up the map, I receive the following error:

Uncaught TypeError: Cannot call method 'getBounds' of undefined
bK
(anonymous function)

Any attempt to add a marker to the page will fail, and I will receive the above message (with no stack trace).

I've removed my controls and recreated them to no effect. I've also tried using this page as the starting page for the application. Any idea would be greatly welcomed.


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 8:18 am
by Alena Prykhodko

Hello Jeff!

How exactly do you add markers?


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 1:09 pm
by Jeff W

Hi Alena,

This happens even when I don't add markers - I'll try and use a simplified example so that the problem is easier to discern.

The only event on my page (which occurs on a load) contains the following code:

function initialize() {
var map = Appery('multiGoogleMap');
map.options['address'] = "115 Federal St Pittsburgh, PA 15212";
map.refresh();
};

$( document ).ready(function() {
google.maps.event.addDomListener(window, 'load', initialize);
});

I have tried this without the document.ready function as well. In this particular instance, I am receiving an error on line 2242 of apperty.js ("Cannot refresh, map is not initialized!"). Is there another way to initialize the map (or guarantee that it in initialized)?


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 3:47 pm
by Igor

Hello,

Could you post your publick app link so we can test it?


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 4:24 pm
by Jeff W

http://tripgenie.app.appery.io/TripPl...

Click on the "Plan it!" button.


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 4:27 pm
by Jeff W

At this point we are able to move the map by setting the address option of the map, but cannot place points. My concern was that we were moving the map prior to initialization, but now I'm not convinced this is the case.


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 4:54 pm
by Jeff W

Sorry for the runaround; here is the current Load Event:
var map = Appery('multiGoogleMap');
map.options['address'] = 'Pittsburgh, PA';
var myLatlng = new google.maps.LatLng(40.363882,-80.044922);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
map.refresh();

and the current error:
Uncaught InvalidValueError: invalid argument to setMap: [object Object]


Google Maps throwing Uncaught TypeError for no clear reason

Posted: Sun Oct 20, 2013 6:03 pm
by Igor

Please try to use next code:
pre
var myOptions = {
zoom :8,
center: new google.maps.LatLng(37.63, -122.424),
mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map($('div[dsid="multiGoogleMap"]').get(0), myOptions);
var myLatlng = new google.maps.LatLng(40.363882,-80.044922);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
/pre