I am trying to do a basic implementation of clustering tokens on a Google map using Google Maps Utility Library v3 .
When I run this, I get an error in the Chrome Developer Tools console:
Uncaught TypeError: Object
This refers to line 649 in the script utility library here: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js . This is the following function:
MarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) { return bounds.contains(marker.getPosition()); };
The code I use is standard Google maps material, the main function of which is:
function initialize(items,loop,zoom) { geocoder = new google.maps.Geocoder(); if (items.length > 0) { var latlng = new google.maps.LatLng(items[0].Lat, items[0].Lng); var myOptions = { zoom: zoom, center: latlng, //mapTypeControl: false, streetViewControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"), myOptions); map.setOptions({styles: stylez}); for (var i = 0; i < items.length; i++) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(items[i].Lat, items[i].Lng), title: items[i].Title, icon: _iconCenter, shadow: shadow, infocontent: items[i].Description }); marker.setMap(map); markersArray.push(marker); } var markerCluster = new MarkerClusterer(map, items); google.maps.event.addListener(map, "tilesloaded", function () { if(loop == true){ SetLoop(); } }); } }
I traced the error function as far as I understand, and it should get the coordinates for the edges of the map in order to be able to determine the boundaries, which should only be standard behavior, but clearly something is wrong.
I wondered if anyone could shed some light on this?
Thanks for any pointers ...