Adding Multiple Markers on Google Map using api v2

I have got a database with latitude and longitude values in it. I can show only one marker at a time. I would like to show multiple markers at the same time. How can I do it?

  • Use of Google Maps JavaScript API v3 in PhoneGap iOS App
  • Google maps v3 open infowindow from a link outside of map
  • Using google maps API, how can we set the current location as the default set location using map.setCenter function?
  • Google Maps caching tiles in hybrid mobile application
  • Removing labels from map markers when using markercluster
  • How do I stringify a google LatLng object?
  • Google Maps Geocoding API, feature from the API missing in their JS api (?)
  • Google Maps API v3: How to remove all markers?
  • Google Maps API enableScrollWheelZoom() - why does it not zoom out correctly?
  • google maps api v3 - javascript - perspective / tilt (not satellite!) ?
  • Rightclicking on Div (infobox) is Disabled. How do I enable it
  • Is it possible to catch exceptions thrown in a JavaScript async callback?
  • One Solution collect form web for “Adding Multiple Markers on Google Map using api v2”

    Here’s a very basic example:

    <!DOCTYPE html>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
      <title>Google Maps Multiple Markers</title> 
      <script src=";v=2&amp"
      <div id="map" style="width: 500px; height: 400px;"></div>
      <script type="text/javascript">
        var locations = [
          ['Bondi Beach',    -33.890542, 151.274856],
          ['Coogee Beach',   -33.923036, 151.259052],
          ['Cronulla Beach', -34.028249, 151.157507],
          ['Manly Beach',    -33.800128, 151.282085],
          ['Maroubra Beach', -33.950198, 151.259302]
        var map = new GMap2(document.getElementById('map'));
        var i;
        map.setCenter(new GLatLng(-33.92, 151.25), 10);
        for (i = 0; i < locations.length; i++) {  
            new GMarker(new GLatLng(locations[i][1], locations[i][2]))


    Adding Multiple Markers on Google Map using api v2