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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:02:51+00:00 2026-06-14T06:02:51+00:00

I need help with Google maps. I want to create a map where I

  • 0

I need help with Google maps. I want to create a map where I could show multiple addresses using multiple pointers. Poblem is that the last address’ pointer icon displays for all addresses. It has probably something to do with the asynchronous geocoder.geocode, but I’m a JS beginner and I’m not able to solve this problem.

Can anyone help please? Thanks.

<html> 
<head> 
    <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</head> 
<body>
<div id="map" style="width: 500px; height: 500px;"></div>

<script type="text/javascript">


var locations = [
    ['Place A', '2430 N 1060 E, North Logan, UT', 'A'],
    ['Place B', '495 W Jackson Street, Knoxville, IA', 'B'],
    ['Place C', '1900 N Flagler Drive, West Palm Beach, FL', 'C']
]; 


var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 0,
    center: new google.maps.LatLng(-33.92, 151.25),
    mapTypeId: google.maps.MapTypeId.ROADMAP
});



var infowindow = new google.maps.InfoWindow();

var marker, i;


for (i = 0; i < locations.length; i++) {  


    var image = new google.maps.MarkerImage('http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + locations[i][2] + '|FF0000|000000',
        new google.maps.Size(21, 34),
        new google.maps.Point(0,0),
        new google.maps.Point(10, 34)
    );

    var geocoder = new google.maps.Geocoder();
    geocoder.geocode( { 
        'address': locations[i][1]
    }, function(results, status){

        if (status == google.maps.GeocoderStatus.OK) {

             marker = new google.maps.Marker({
                position: results[0].geometry.location,
                map: map, 
                icon: image
            });
        } 
    });

}
</script>
</body>

  • 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-14T06:02:52+00:00Added an answer on June 14, 2026 at 6:02 am

    Try this code:

    var marker, i;
    
    for (i = 0; i < locations.length; i++) {  
      marker = createMarker(locations[i]);
    }
    function createMarker(location) {
      var image = new google.maps.MarkerImage('http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + location[2] + '|FF0000|000000',
            new google.maps.Size(21, 34),
            new google.maps.Point(0,0),
            new google.maps.Point(10, 34)
        );
    
        var geocoder = new google.maps.Geocoder();
        geocoder.geocode( { 
            'address': location[1]
        }, function(results, status){
    
            if (status == google.maps.GeocoderStatus.OK) {
    
                 marker = new google.maps.Marker({
                    position: results[0].geometry.location,
                    map: map, 
                    icon: image
                });
            } 
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help writing a script downloads data from google insight using c# this is
I want to remove an individual marker from Google map. I am using version
I am working on Web Application that uses Google map. I need to verify
I'm with a project on Google maps, that I want to save routes and
I want to know if this is possible with google maps. I create a
I need to develop an application using Google Maps in Android to locate my
I need to create a google maps web application, where I can import a
I am really new to google maps and need some help. I am calling
I need some help, I am trying to make an controller using Google Analytics
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded

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.