anildigital / maps

Repository for my google maps codes

This URL has Read+Write access

maps / mygmaps.js
100644 30 lines (27 sloc) 0.649 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* Using Google Gecoding
* Author: Anil Wadghule
*/
 
var map = null;
 
google.load("maps", "2");
geocoder = null;
address = "Gateway of India, Mumbai";
function initialize() {
  if (GBrowserIsCompatible()) {
    map = new google.maps.Map2(document.getElementById("map_canvas"));
    geocoder = new google.maps.ClientGeocoder();
    geocoder.getLatLng(
      address,
    function(point) {
      if (!point)
        alert(address + " not found");
      else {
        map.setCenter(point, 13);
        var marker = new google.maps.Marker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(address);
      }
    }
   );
  }
}