Google Maps Api 3: TypeError no detectado: no se puede llamar al método 'setCenter' de undefined

I have been trying to get my geocoder working this morning for the following URL but can't seem to figure out what I am doing wrong:

When clicking encode, the geocoder is doing it's job and returning the correct Lat / Long coordinates but it gets hung up on setCenter.

Uncaught TypeError: Cannot call method 'setCenter' of undefined

I tried to follow the Google example here and can't understand why this won't work:

Gracias de antemano.

preguntado el 09 de marzo de 12 a las 15:03

1 Respuestas

map is not in scope. You declare map twice – once in the global scope and once in initialize, but you only set the map in initialize (the global map is shadowed).

Eliminar el var desde var map = new google.maps.Map(...); (pero no el var map; en la cima).

respondido 09 mar '12, 15:03

Wow, I didn't even see that. Thank you for your help Josh. Do you know if there is also a way to ensure one map layer always loads before the other? I haven't been able to find it searching all morning. - Mike Averto

I'm not sure... you might try opening another question. - josh3736

Thank you. Had the same error. I know ask me why I didn't see that. hmmm... whatever, works now :) +1 - roemel

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.