I get error in MarkerClusterer.js

2,647 views
Skip to first unread message

John T

unread,
Dec 21, 2010, 10:08:19 PM12/21/10
to Google Maps JavaScript API v3
I get the following error in the MarkerClusterer.js routine.

Uncaught TypeError: Object [object DOMWindow] has no method 'extend'

This error is at line 65 of MarkerClusterer.js, which is:
this.extend(MarkerClusterer, google.maps.OverlayView);

I'm new with Google.maps and no expert on Javascript but I've looked
at the examples and can't figure out where I've screwed up. Here is a
link to my code: http://www.horsetraildirectory.com/dec10_map_test_cluster.htm

Any help would be greatly appreciated.

Luke Mahé

unread,
Dec 21, 2010, 10:11:47 PM12/21/10
to google-map...@googlegroups.com
Hi John,

Change 
var mc = MarkerClusterer(map,markerarray,mcOptions);
to
var mc = new MarkerClusterer(map,markerarray,mcOptions);

-- Luke



--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


John T

unread,
Dec 22, 2010, 9:32:47 AM12/22/10
to Google Maps JavaScript API v3
Thanks Luke,

I don't get the error any more but...

In Chrome, the map doesn't show and Javascript console doesn't show
any fatal errors;

In IE, the map shows but no pointers.

John T

P.S. Thanks to you and everyone who contributes. I've been able to
work my way through knowing nothing to getting a pointer map
operational by following the descriptions and examples. Good Work!
(I still don't know anything, but it's results not knowledge Im after.
lol)
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2B­unsub...@googlegroups.com>
> > .

Rossko

unread,
Dec 22, 2010, 1:25:11 PM12/22/10
to Google Maps JavaScript API v3
> In Chrome, the map doesn't show and Javascript console doesn't show
> any fatal errors;

In FF2 also, no map and no script error.

<script .. src="http://maps.google.com/maps/api/js?
sensor=false&key=ABQIAAAAJ4iU9....
You don't need a key with V3 maps

<div id="map-container">
<div id="map_canvas" style="float:right;width:70%; height:100%">
The map_canvas is 70% of the width of something indeterminate. Some
browsers will report that as zero-size, causing the API to build a
zero-size map - which we can't see ...
Try giving the div a fixed pixel size.

It takes some time to process your 500 markers. I suspect a lot of
wasted effort in your getinfo() function (from infowindow.js) whic is
called for each marker creation.
getinfo() creates a new array of all 500 info content every time you
call it, then returns just one of them.
Maybe create that array just once?

> In IE, the map shows but no pointers.

In IE6 (which isn't really a fair test) I get a map with odd little
markers on it, not sure if these are the expected "pointers".
There is an error " '1' is null or not an object "
I haven't worked out where that comes from yet, may be in the
infowindow content somewhere?

John T

unread,
Dec 22, 2010, 10:22:57 PM12/22/10
to Google Maps JavaScript API v3
The process time for 500 makers is the reason I want to cluster. I
changed the infoWindow content load so it only calls getinfo() once.
Thanks for the tip. I'm using IE8 on a ten yr old Dell and the
process time didn't seem to improve much. Chrome is much faster,
which I tested with the change to a earlier version
(www.horsetraildirectory.com/map). That version also does not specify
a width but Chrome works fine with it. With the one I'm working on
( http://www.horsetraildirectory.com/dec10_map_test_cluster.htm)
Chrome doesn't show the map.

Using IE, I get the map and markers (I called pointers earlier) but
I'm missing something with the MarkerClusterer.

The code appears to be running but there aren't any clusters. Am I
supposed to group my markers in some way? Or did I just screw up
someplace that I can't identify.

Thanks for your help

John T

Rossko

unread,
Dec 23, 2010, 4:33:33 AM12/23/10
to Google Maps JavaScript API v3
In FF2 I can now see map and green markers.

Your createMarker() function is doing two things wrong at the moment;

It adds each created marker to the map - don't do that, you want the
clusterer to handle who gets added and who doesn't. Create the
markers without an initial attachment to the map.

It doesn't return anything. The code calling it builds an array of
500 null returns and passes that to the clusterer, which finds it has
nothing to do. Return the marker you create so that it can be pushed
onto to the markerarray.

John T

unread,
Dec 23, 2010, 9:36:35 AM12/23/10
to Google Maps JavaScript API v3
Bingo! It's working now. Thanks

I really appreciate your timely help

John T
Reply all
Reply to author
Forward
0 new messages