Sunday, August 25, 2013

Google map complete script based on Latitude and Longitude

Hello Developers,

Sometime we have requirement to show google maps on our websites or clients website and we need to show that google markers on particular location. I am writing this article for those who have very less experience in implementing google maps

Here is code snippet:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps API Sample</title>
    <script src="//maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAuPsJpk3MBtDpJ4G8cqBnjRRaGTYH6UMl8mADNa0YKuWNNa8VNxQCzVBXTx2DYyXGsTOxpWhvIG7Djw" type="text/javascript"></script>
    <script type="text/javascript">

 
      function initialize({
        if (GBrowserIsCompatible(){
          var map new GMap2(document.getElementById("map_canvas"));
          map.setCenter(new GLatLng(30.7343000,76.7933000)13);
          var point new GLatLng(30.7343000,76.7933000);
          map.addOverlay(new GMarker(point));
        }
      }

 
    

    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">
    <div id="map_canvas" style="width: 500px; height: 300px"></div>
  </body>
</html>


Output:



Hope this will help you :)

No comments:

Post a Comment