tags:

views:

133

answers:

1

Am working on Google maps and Bing Maps and want to add multiple markers (Overlays) on Maps I Got GMap.js from some where and I dont know how to add using this api.

+3  A: 
 function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);

        // Add 10 markers to the map at random locations
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();
        for (var i = 0; i < 10; i++) {
          var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),
                                  southWest.lng() + lngSpan * Math.random());
          map.addOverlay(new GMarker(latlng));
        }
      }
    }

Don't forget to include javascript file. More detail here

Source: http://code.google.com/apis/maps/documentation/examples/marker-simple.html

Adeel