Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9147253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:56:35+00:00 2026-06-17T10:56:35+00:00

This javascript code hides all the markers on a google map which I initially

  • 0

This javascript code hides all the markers on a google map which I initially populated using the gmaps4rails gem in a Rails 3.2 app.

var markers=Gmaps.map.markers
for(i=0;i<markers.length;i++){markers[i].serviceObject.setVisible(false); }

The issue I have is that the “clusters” still show the same counters before and after the above code is ran. I’ve searched around a bit and haven’t figured out the write line(s) to add to update the clusters.

P.S. I’m pretty sure that “cluster” is the correct name for what I’m talking about. What I’m referring to are the counters that the map shows when you are zoomed out to a view where there isn’t enough room to distinguish between individual markers and the map shows a colored, circularish icon with a count of the number of map markers in that area.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:56:37+00:00Added an answer on June 17, 2026 at 10:56 am

    If you want to update your map with a different set of markers, we’ll call them differentMarkers you can call

    var differentMarkers = ...
    Gmaps.map.replaceMarkers(differentMarkers);
    

    and the clusters will update.

    If you want to add markers to the existing set use

    var additionalMarkers = ...
    Gmaps.map.addMarkers(additionalMarkers);
    

    I haven’t found a method to remove markers but you could call the replaceMarkers with an array that has the markers removed.

    Not sure if this is the way it is meant to be done but seems to work.


    Adding and replacing markers this way is also explained in the wiki for gmaps4rails. https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Javascript-goodies

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm injecting JavaScript code into a website for personal use, using a Google Chrome
I have this jquery code: <script type=text/javascript> jQuery(document).ready(function($){ // hides the slickbox as soon
I have some tables here, and using this javascript below, I made them hide
I have the following Javascript code which controls an accordion type set of divs.
I'm using some javascript or jQuery code to hide and show different divs in
I have custom javascript code for tabs which works fine, but Im trying to
I have this javascript code: // Meldingen groen / oranje / rood $(#blokken .overzicht
I have this javascript code: function newsOverview() { $(.list-news li:gt(3)).hide(); $(.box-news .btn-1).on('click', function(e){ e.preventDefault;
Please someone Fix this Javascript Code. This script actually reads the URL Parameter and
I have this JavaScript code: $(#midden-offertes form .subvragen).hide(); $(#midden-offertes form .veld .radio :radio).change(function() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.