ruby-on-railsgoogle-mapsgmaps4rails

How to access marker cluster for the Google Maps For Rails?


I'm trying to add custom functionality to my map where a user can filter out certain markers. Using simple jquery, I am to just find the marker using css selectors and do something like:

$('.marker').hide()

This works fine...however, when I zoom out, the marker is still considered there in the marker cluster count. I want to adjust the count to take into account that I hid the marker.

Any help would be appreciated. I'm not even sure how to access the marker cluster object as documented here:

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

Do I do something like:

handler.getCluster()

Thank you for your help!


Solution

  • I dont really understand your jQuery stuff here for google map markers...

    You should use the existing methods on the objects returned by the addMarker(s) method:

    Anyway, to answer your primary question:

    handler.clusterer
    

    as usual the googleObject is available:

    handler.clusterer.getServiceObject()