MarkerClusterer for V3

13,387 views
Skip to first unread message

Luke (Google Employee)

unread,
Feb 22, 2010, 9:10:37 PM2/22/10
to Google Maps JavaScript API v3
Hey everyone!

I've just checked in the first version of the Google Maps v3
MarkerClusterer to the utility library:
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/

I've tried to keep the interface the same as the v2 library so the
transition to v3 should hopefully be fairly simple.

If you're interested, have a read of the reference doc:

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/docs/reference.html

Check out some examples here:

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/docs/examples.html.

Reply back to this thread if you run into any problems/bugs.


Thanks!

Luke

Esa

unread,
Feb 23, 2010, 7:18:21 PM2/23/10
to Google Maps JavaScript API v3
Cool. I am sure that many people will make use of clustering
immediately.

Seems to work fine but I did not get the first line in the source
code:

this.extend(MarkerClusterer, google.maps.OverlayView);

Where does that extend method come from?

Luke Mahé

unread,
Feb 23, 2010, 7:25:08 PM2/23/10
to google-map...@googlegroups.com
extend is defined on line 132 of markerclusterer.js


--
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.


Mario

unread,
Mar 18, 2010, 12:58:03 PM3/18/10
to Google Maps JavaScript API v3
Hi Luke,

first of all, thank you for MarketClusterer V3.

I think I found something odd / unexpected; don't know if it is a bug,
so I will give you an overview first, if needed a can then provide
further details.

When, after creating a marker, I use the addMarker() method this seems
to enlarge the the lat/lng bounds of the current viewport (the
LatLngBounds that you get from the getBounds() method of the Map
class), even if the position of each added marker is contained within.
On the contrary, if I just create each marker (with the constructor of
the Marker class) the lat/lng bounds remains exactly the same (as I
would expect).

As you can imagine this is quite an issue, in my personal case I use
this LatLngBounds as a parameter to download appropriate data from a
server DB.

Is this behavior expected?

I look forward to your comments.

Best,

Mario


On 23 Feb, 03:10, "Luke (Google Employee)" <lu...@google.com> wrote:
> Hey everyone!
>
> I've just checked in the first version of the Google Maps v3

> MarkerClusterer to the utility library:http://google-maps-utility-library-v3.googlecode.com/svn/trunk/marker...


>
> I've tried to keep the interface the same as the v2 library so the
> transition to v3 should hopefully be fairly simple.
>
> If you're interested, have a read of the reference doc:
>

> http://google-maps-utility-library-v3.googlecode.com/svn/trunk/marker...


>
> Check out some examples here:
>

> http://google-maps-utility-library-v3.googlecode.com/svn/trunk/marker....

Luke Mahé

unread,
Mar 18, 2010, 2:51:20 PM3/18/10
to google-map...@googlegroups.com
Hi Mario,

I noticed this too yesterday and fixed it. Grab the latest version from the trunk and it should be good to go.

Let me know if you are still having problems.

- Luke

Mario

unread,
Mar 18, 2010, 8:07:15 PM3/18/10
to Google Maps JavaScript API v3
Ciao Luke,

excellent, just tried and it works smoothly, issue solved.

Thank you very much for your quick reply.

Best,

Mario

Mike Wood

unread,
Apr 10, 2010, 11:02:50 AM4/10/10
to Google Maps JavaScript API v3
Hi Luke,

There seems to be a slight problem when you zoom the map out. The
clusters that should appear 'around the edges' in the new view don't
unless you pan the map slightly at which point they jump into view.
Same behavior in demo maps.

I see the code has a listener to spot zoom changes but this doesn't
seem to fully work?

Thanks

Luke Mahé

unread,
Apr 12, 2010, 1:46:20 PM4/12/10
to google-map...@googlegroups.com
Thanks for pointing that out. I've fixed the bug, I should have been listening to bounds_changed.

- Luke

Mike Wood

unread,
Apr 12, 2010, 1:55:52 PM4/12/10
to Google Maps JavaScript API v3
That did it - thanks. Perfect! :-)

Mike

On Apr 12, 12:46 pm, Luke Mahé <lu...@google.com> wrote:
> Thanks for pointing that out. I've fixed the bug, I should have been
> listening to bounds_changed.
>
> - Luke
>

> On Sat, Apr 10, 2010 at 8:02 AM, Mike Wood <mikewoodconsult...@gmail.com>wrote:
>
> > Hi Luke,
>
> > There seems to be a slight problem when you zoom the map out. The
> > clusters that should appear 'around the edges' in the new view don't
> > unless you pan the map slightly at which point they jump into view.
> > Same behavior in demo maps.
>
> > I see the code has a listener to spot zoom changes but this doesn't
> > seem to fully work?
>
> > Thanks
>
> > --
> > 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<google-maps-js-api-v3%2Bunsu...@googlegroups.com>

Mike Wood

unread,
Apr 12, 2010, 2:13:14 PM4/12/10
to Google Maps JavaScript API v3
Luke,

PS - I created differently colored image versions of the correct
larger sizes for m4.png and m5.png so that the code works fully with
clusters of > 1000 markers (currently the demo just repeats the m3
image for 1,000 + and 10,000 +).

If you would like to use them they are here:

http://gsak.info/stats2/maps/m4.png

http://gsak.info/stats2/maps/m5.png

Mike


On Apr 12, 12:46 pm, Luke Mahé <lu...@google.com> wrote:

> Thanks for pointing that out. I've fixed the bug, I should have been
> listening to bounds_changed.
>
> - Luke
>

> On Sat, Apr 10, 2010 at 8:02 AM, Mike Wood <mikewoodconsult...@gmail.com>wrote:
>
> > Hi Luke,
>
> > There seems to be a slight problem when you zoom the map out. The
> > clusters that should appear 'around the edges' in the new view don't
> > unless you pan the map slightly at which point they jump into view.
> > Same behavior in demo maps.
>
> > I see the code has a listener to spot zoom changes but this doesn't
> > seem to fully work?
>
> > Thanks
>
> > --
> > 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<google-maps-js-api-v3%2Bunsu...@googlegroups.com>

Luke Mahé

unread,
Apr 12, 2010, 3:06:22 PM4/12/10
to google-map...@googlegroups.com
Thanks. I've updated the images with your versions.

- Luke

To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.

lucian.jp

unread,
Jun 4, 2010, 12:38:57 PM6/4/10
to Google Maps JavaScript API v3
I was trying to get the bounds of all the markers in the
markerClusterer object. So I tried to use the getExtendedBounds
mentioned in the reference page. Unfortunately the getExtendedBounds
method doesn’t exist in the markerclusterer_compiled.js. Strangely,
this function does exist in the markerClusterer.js but does not work
anymore since it uses function that doesn’t exist anymore in the
Google map API v3.

I did not analyse everything around it, but the getExtendedBounds
function definitely need some cleanup.

Luke Mahé

unread,
Jun 7, 2010, 7:43:35 PM6/7/10
to google-map...@googlegroups.com
Hi,

I think you are probably using a old revision that was accessing the projection object in a different way. The current trunk version that was updated a few weeks ago has this fixed. Also getExtenededBounds is not exported in the compiled version because you don't really need to call it, if you need it then you can update your copy to export that function and recompile it.

-- Luke


--

Jarrod

unread,
Jul 13, 2010, 12:21:24 PM7/13/10
to Google Maps JavaScript API v3
Hi Luke,

Really liking the MarkerClusterer plugin.

Just wondering if there is a better way to get the center of a cluster
as it just seems to set the center based on the first marker in the
cluster. This isn't a huge issue, it's just quite a noticable
difference for markers that are on the edges of the grid.

Cheers,
Jarrod

Luke Mahé

unread,
Jul 13, 2010, 8:57:57 PM7/13/10
to google-map...@googlegroups.com
Hey Jarrod,

I was thinking allowing a option to make the cluster center be the true center. The reason it is not at the moment is because I wanted it to act the same as the v2 clusterer so developers could easily switch over, but I will have a look at adding it soon.

-- Luke



--

doug

unread,
Jul 19, 2010, 4:12:11 AM7/19/10
to Google Maps JavaScript API v3
Thank you for developing a V3 clusterer, it's very much appreciated. I
don't know if you are looking for suggestions to improve it still
further but is there a way it could be made to not make markers
visible if they weren't visible before clustering? We've a number of
different categories and it would be awesome to just have the
categories that are visible cluster.

I've put a work in progress version up on our website
www.development.arvclub.co.uk/atlas.php. It is password protected so
you'll need to log on as test user with the password letmein. I
apologise for the need to password protect it but it's a live site.

Regards
Doug

Jarrod

unread,
Aug 12, 2010, 8:05:13 AM8/12/10
to Google Maps JavaScript API v3
Thanks Luke, will keep my eyes open.
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .

Fledder

unread,
Dec 16, 2011, 5:26:41 AM12/16/11
to google-map...@googlegroups.com
hi Luke,

I tried to report an issue before but I can't find my reply back, so hereby I'm trying again. Great work on this library by the way!

The issue is as follow. I run a photo website that displays geotagged photos on a map. It is quite common for users to geotag multiples images as the exact same coordinates, for example a general city location because they don't know the exact position within the city. So let's imagine there's two photos with the exact same coordinates. MarkerClusterer will then create a cluster of 2, which is correct. However, as you click on that cluster, nothing happens. The markers are not revealed. I think this has to do with the fact that they are at the exact same location. Any ideas?

kind regards,

Ferdy


Reply all
Reply to author
Forward
0 new messages