Google Maps API: Uncaught TypeError: Object #<kf> has no method 'fitBounds'

525 views Asked by At

i'm trying to do a map with Google Maps Api v3.

I have the map working, with the markers loaded ok from a XML file.

But i need to center view to see all markers, I use this:

var map = new google.maps.Map(document.getElementById("map"));
var bounds = new google.maps.LatLngBounds();

-- here I load markers --
-- for each marker, i do: --
bounds.extend(marker.position);

and finally:

map.fitBounds(bounds);

but, at this point, I get this annoying error:

Uncaught TypeError: Object # has no method 'fitBounds'

Somebody knows why?

0

There are 0 answers