Jeff W
Posts: 0
Joined: Sun Oct 20, 2013 8:03 am

Google Maps throwing Uncaught TypeError for no clear reason

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.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Google Maps throwing Uncaught TypeError for no clear reason

Hello Jeff!

How exactly do you add markers?

Jeff W
Posts: 0
Joined: Sun Oct 20, 2013 8:03 am

Google Maps throwing Uncaught TypeError for no clear reason

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)?

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

Google Maps throwing Uncaught TypeError for no clear reason

Hello,

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

Jeff W
Posts: 0
Joined: Sun Oct 20, 2013 8:03 am

Google Maps throwing Uncaught TypeError for no clear reason

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.

Jeff W
Posts: 0
Joined: Sun Oct 20, 2013 8:03 am

Google Maps throwing Uncaught TypeError for no clear reason

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]

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

Google Maps throwing Uncaught TypeError for no clear reason

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

Return to “Issues”