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 9206301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:08:48+00:00 2026-06-18T00:08:48+00:00

After feeding a bunch of points to a Google Map I realized I got

  • 0

After feeding a bunch of points to a Google Map I realized I got way too many markers on my hand so I tried to use MarkerClusterer, with no success so far. As to my understanding, it should be called after the map is instantiated and populated – so I tried adding a markerCluster = new MarkerClusterer(map); just before return; Well, it doesn’t work and I have no idea how could I move forward.

Also, in my example, init() is not called anywhere, but the map works. Does the instantiation happen at line #4? Most important, where do I go wrong?

function init() {
    var latlng = new google.maps.LatLng(map_center[0], map_center[1]);
    var myOptions = { zoom: 7, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, maxZoom: 18};
    map = new google.maps.Map(document.getElementById("map_div"), myOptions);

    for (var i = 0; i<addresses.length; i++) 
        {
            var pos = new google.maps.LatLng(
                    parseFloat(addresses[i]['lt']), 
                    parseFloat(addresses[i]['ln']) 
                );
            addMarker(pos, addresses[i]);   

        }

    return;
}
  • 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-18T00:08:50+00:00Added an answer on June 18, 2026 at 12:08 am

    You need to pass an array of markers to the MarkerClusterer constructor. Here is your modified init function with very basic usage of MarkerClusterer:

    function init() {
      var latlng = new google.maps.LatLng(map_center[0], map_center[1]);
      var myOptions = { zoom: 7, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, maxZoom: 18};
      map = new google.maps.Map(document.getElementById("map_div"), myOptions);
      var markers = [];
    
      for (var i = 0; i<addresses.length; i++){
        var pos = new google.maps.LatLng(
          parseFloat(addresses[i]['lt']), 
          parseFloat(addresses[i]['ln']) 
        );
        markers.push(new google.maps.Marker({'position': pos}));
    
      }
    
      var markerCluster = new MarkerClusterer(map, markers);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I set the min height of a datagrid that way: <DataGrid MinRowHeight=40> After feeding
After deploying WCF server (svc) on my Server, I have got this message when
After discovering about Javascript namespaces, I tried to implement them but I run into
While doing a school project I've been running into the following problem: After feeding
I am working on feeding Matlab's simulation data to Google Earth Plug-in via COM.
After reading this nice article (The Care and Feeding of Pre-Compiled Headers), I have
After installing the PyDev plugin for Eclipse (by feeding http://pydev.org/updates in Eclipse's Install new
Alright, so after years of feeling that I've been doing it the wrong way,
Introduction In my current organisation, we have many desktop and web applications all feeding
After a bit of troubleshooting I realized ( at least I'm pretty sure )

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.