MarkerClusterer jump to zoom level on click issue

5,050 views
Skip to first unread message

slinky

unread,
Dec 1, 2010, 5:47:34 AM12/1/10
to Google Maps JavaScript API v3
Hello together,

I'm using the newest version of the markerclusterer v3 and it works
fine.
But now I have a requirement in the behavior which is happend if I
click on a cluster icon.
I have an example in which I created the markercluster with the
following options:

markerClusterer = new MarkerClusterer(map, markersArray, {gridSize:
70, zoomOnClick: true, averageCenter: false, maxZoom: 13});

Normally on click the cluster jumps to the next zoom level and shows
the next cluster resolution. But in some cases, if there are a few
markers in the same place with low distance between them the
markerclusterer jumps to the next zoom level and shows the same
cluster icon with the same number of markers. On the next click the
clusterer jumps to the next zoom level and shows the same cluster icon
again and so on.

If there a possibility to jump direct to this zoom level, where the
markerclusterer has resolved the cluster (next cluster splitting or
showing the markers)?
Is it necessary extending the markerclusterer code to provide this
functionality or is it possible to implement this by using functions
from outside the markerclusterer code?

Thanks a lot!
Raik

slinky

unread,
Dec 1, 2010, 6:29:20 AM12/1/10
to Google Maps JavaScript API v3
Hi all,

In this markerclusterer speed test example you can see what I mean:

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

You musst click 4 times on the cluster which includes 2 markers to see
the markers.

regards
Raik

Show on the cluster near Olso/Norway

geoco...@gmail.com

unread,
Dec 1, 2010, 9:03:52 AM12/1/10
to Google Maps JavaScript API v3
On Dec 1, 3:29 am, slinky <rtrae...@web.de> wrote:
> Hi all,
>
> In this markerclusterer speed test example you can see what I mean:
>
> http://google-maps-utility-library-v3.googlecode.com/svn/trunk/marker...
>
> You musst click 4 times on the cluster which includes 2 markers to see
> the markers.

And that is what it is coded to do. Where is your page? Did you
change it to do what you wanted?

Have you tried adding a clusterclick event handler?

http://groups.google.com/group/google-maps-js-api-v3/search?group=google-maps-js-api-v3&q=clusterclick

-- Larry
> > Raik- Hide quoted text -
>
> - Show quoted text -

slinky

unread,
Dec 1, 2010, 9:44:20 AM12/1/10
to Google Maps JavaScript API v3


On 1 Dez., 15:03, "geocode...@gmail.com" <geocode...@gmail.com> wrote:
> On Dec 1, 3:29 am, slinky <rtrae...@web.de> wrote:
>
> > Hi all,
>
> > In this markerclusterer speed test example you can see what I mean:
>
> >http://google-maps-utility-library-v3.googlecode.com/svn/trunk/marker...
>
> > You musst click 4 times on the cluster which includes 2 markers to see
> > the markers.
>
> And that is what it is coded to do.  Where is your page?  Did you
> change it to do what you wanted?
>
> Have you tried adding a clusterclick event handler?
>
> http://groups.google.com/group/google-maps-js-api-v3/search?group=goo...
>
>   -- Larry
>
>
>

Hello Larry,

sorry, at the moment I don't have a public page, because its in
development status.
I've posted the link above, just to give an example.
In this example I can good point out what I mean: if you click on the
cluster near Oslo/Norway you must click 4 times on the 2 markers
including cluster before you really see the markers.
However, I will try the method you suggested: handle the clusterclick
event handler and write my own extension.

Thank you
Raik

geoco...@gmail.com

unread,
Dec 1, 2010, 11:16:02 AM12/1/10
to Google Maps JavaScript API v3
On Dec 1, 6:44 am, slinky <rtrae...@web.de> wrote:
> On 1 Dez., 15:03, "geocode...@gmail.com" <geocode...@gmail.com> wrote:
>
> > On Dec 1, 3:29 am, slinky <rtrae...@web.de> wrote:
>
> > > Hi all,
>
> > > In this markerclusterer speed test example you can see what I mean:
>
> > >http://google-maps-utility-library-v3.googlecode.com/svn/trunk/marker...
>
> > > You musst click 4 times on the cluster which includes 2 markers to see
> > > the markers.
>
> > And that is what it is coded to do.  Where is your page?  Did you
> > change it to do what you wanted?
>
> > Have you tried adding a clusterclick event handler?
>
> >http://groups.google.com/group/google-maps-js-api-v3/search?group=goo...
>
> >   -- Larry
>
> Hello Larry,
>
> sorry, at the moment I don't have a public page, because its in
> development status.

Your problem not mine.

> I've posted the link above, just to give an example.
> In this example I can good point out what I mean: if you click on the
> cluster near Oslo/Norway you must click 4 times on the 2 markers
> including cluster before you really see the markers.

There is not code to handle a cluster click on that page. It is doing
what it is designed to and is not a problem. If you want different
behavior, you need to implement it, then if you have problems post a
link to your map for help.

-- Larry

> However, I will try the method you suggested: handle the clusterclick
> event handler and write my own extension.
>
> Thank you

Luke Mahé

unread,
Dec 1, 2010, 7:08:36 PM12/1/10
to google-map...@googlegroups.com
Hey Guys,

This is probably how the MarkerClusterer should have always worked :) Instead of fitting to the bounds of the cluster it was fitting to the extend bounds of the cluster.

I've fixed this and you and grab the latest version from the trunk.

Also on a side note, a few weeks back I made a change so that markers are added to the closest cluster instead of the first cluster that they land in, so if you haven't upgraded to the latest version you should :)

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


slinky

unread,
Dec 2, 2010, 8:29:22 AM12/2/10
to Google Maps JavaScript API v3
Hello together,

I want to say thanks to Luke for fixing the markerclusterer so fast.
It helps me.
I've written my own solution by catching the 'clusterclick' handler
from outside which also works but its better to use your new version.
Thank you very much.

@Larry
I know what you mean and I know the given markerclusterer speed test
example is for what it stands for: to test the performance of the
implementation.
It was not my intention to point out problems of this implementation.
I wanted to give JUST AN EXAMPLE not more. I could use any other
markerclusterer example for that.

However, the issue is solved now and it works fine.
Thank you all.

Raik

On 2 Dez., 01:08, Luke Mahé <lu...@google.com> wrote:
> Hey Guys,
>
> This is probably how the MarkerClusterer should have always worked :)
> Instead of fitting to the bounds of the cluster it was fitting to the extend
> bounds of the cluster.
>
> I've fixed this and you and grab the latest version from the trunk.
>
> Also on a side note, a few weeks back I made a change so that markers are
> added to the closest cluster instead of the first cluster that they land in,
> so if you haven't upgraded to the latest version you should :)
>
> -- Luke
>
> On Thu, Dec 2, 2010 at 3:16 AM, geocode...@gmail.com
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .

Barnaby Claydon

unread,
Dec 2, 2010, 5:57:28 PM12/2/10
to Google Maps JavaScript API v3
Hey Luke,

Thanks for this fix, I was just looking at writing my own too. I don't
see the update on trunk though, still says Feb 22 - am I looking in
the wrong place?

I'm looking here:
http://code.google.com/p/google-maps-utility-library-v3/source/browse/trunk/markerclusterer/src/markerclusterer.js?r=71

Thanks again!
-Barnaby


On Dec 1, 7:08 pm, Luke Mahé <lu...@google.com> wrote:
> Hey Guys,
>
> This is probably how the MarkerClusterer should have always worked :)
> Instead of fitting to the bounds of the cluster it was fitting to the extend
> bounds of the cluster.
>
> I've fixed this and you and grab the latest version from the trunk.
>
> Also on a side note, a few weeks back I made a change so that markers are
> added to the closest cluster instead of the first cluster that they land in,
> so if you haven't upgraded to the latest version you should :)
>
> -- Luke
>
> On Thu, Dec 2, 2010 at 3:16 AM, geocode...@gmail.com
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .

Luke Mahé

unread,
Dec 3, 2010, 6:03:21 PM12/3/10
to google-map...@googlegroups.com
Hi Barnaby,

Remove the r=71 from the url and you'll get the latest version - http://code.google.com/p/google-maps-utility-library-v3/source/browse/trunk/markerclusterer/src/markerclusterer.js

-- Luke


To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages