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

  • SEARCH
  • Home
  • 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 6571709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:54:59+00:00 2026-05-25T14:54:59+00:00

I know markerClusterer able to handling large amounts markers on google map. By referring

  • 0

I know markerClusterer able to handling large amounts markers on google map.
By referring this example code as below shown

<script src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <script type="text/javascript" src="../src/data.json"></script>
    <script type="text/javascript">
      var script = '<script type="text/javascript" src="../src/markerclusterer';
      if (document.location.search.indexOf('compiled') !== -1) {
        script += '_compiled';
      }
      script += '.js"><' + '/script>';
      document.write(script);
    </script>

    <script type="text/javascript">
      function initialize() {
        var center = new google.maps.LatLng(37.4419, -122.1419);

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 3,
          center: center,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        var markers = [];
        for (var i = 0; i < 100; i++) {
          var dataPhoto = data.photos[i];
          var latLng = new google.maps.LatLng(dataPhoto.latitude,
              dataPhoto.longitude);
          var marker = new google.maps.Marker({
            position: latLng
          });
          markers.push(marker);
        }
        var markerCluster = new MarkerClusterer(map, markers);
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>

First question, why this example infowindow cannot work?

Second if I have such array like this:

[-6.358851,106.889359] => Array
        (
            [0] => stdClass Object
                (
                    [name] => C
                )

        )

    [-6.154060,106.854080] => Array
        (
            [0] => stdClass Object
                (                        
                    [name] => A
                )

            [1] => stdClass Object
                (
                    [name] => B
                )

        )

Can I do like those have the same lat and lon, stack the information within one infowindow? I know it could be. I just wondering how to do it. And how does the json data format to get the right output on map?

Hope anyone here can help me. Thanks in advance.

  • 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-05-25T14:55:00+00:00Added an answer on May 25, 2026 at 2:55 pm

    First question; what infowindow? Your code has no infowindow in it. What you need to do is inside your loop, create an infowindow variable for each marker, set its content, and create an event listener for that marker.

    <script type="text/javascript">
        var map;
    
        function initialize() {
            var homeLatlng = new google.maps.LatLng(51.476706,0); // London
            var homeLat = 51.476706;
            var homeLng = 0;
    
            var myOptions = {
                zoom: 5,
                center: homeLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
    
            map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
            for (var i = 0; i < 100; i++) {
                var latLng = new google.maps.LatLng(homeLat, homeLng+i);
                var marker = new google.maps.Marker({
                    position: latLng,
                    map: map
                });
    
                setContent(marker, i);
            }
        }
    
        function setContent(marker, i) {
            var infowindow =  new google.maps.InfoWindow({
                content: 'clicked marker ' + (i+1)
            });
    
            google.maps.event.addListener(marker, 'click', function(event) {
               infowindow.open(map, marker);
            });
        }
    
    
        google.maps.event.addDomListener(window, 'load', initialize);
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using GMaps V3 with MarkerClusterer from http://code.google.com/p/gmaps-utility-library-dev/ Markers displayed on the map are
Hi everyone, I'm making a google map with markers of our company's customers,so that
I have a Google map that is showing a number of markers. When the
I know you can minify/condense Javascript or CSS code, but can you do this
Know of any good libraries for this? I did some searches and didn't come
Know this might be rather basic, but I been trying to figure out how
I know this might be a no-brainer, but please read on. I also know
I know this is a stupid question, but I've looked for 45 mins now
I know this is a very simple question for you experts,but please forgive me.Im
I know this is a common problem. I've been looking at the various solutions

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.