Wednesday 27 June 2012

How to use Google Map v3 in your site





InOrder to use Google Maps Version 3 you will need  a  Api key


To create your API key:
  1. Go to the link https://code.google.com/apis/console and log in with your Google Account.
  2. Click the Services menu from the left side
  3. Activate the Google Maps API v3 service.
  4. select the API Access  from the side. Your API key is available from the API Access page . This API key is used in  browser apps.


     once you have the key  you can use the following code to integrate the google maps
 version 3 in your site.


     Google has anounced a limitation on the usage of  google maps version 3, 25000 views
per day.If this limit is exceeded  you ll be charged. You need not worry unless your site 
has visitors in the thousands.


<html>
 <head>
    <title></title>  

    <style type="text/css">
        
        html { height: 100% }    
        body { height: 100%; margin: 0px; padding: 0px }    
        #map_canvas { height: 100% }  
        
    
    </style>

    <script src="http://maps.googleapis.com/maps/api/js?
    key=Your_Api_Key&sensor=false" type="text/javascript">
    </script>

    <script type="text/javascript">
      function initialize() {
        var latlng = new google.maps.LatLng(-34.397, 150.644); 
        var myOptions = {zoom: 3, center: latlng, mapTypeId: 
        google.maps.MapTypeId.ROADMAP};
        var map = new google.maps.Map
       (document.getElementById("map_canvas"), myOptions);
     
    </script>

 </head>
  
 <body>  
    <div>
      <div id="map_canvas" style="height: 300; width: 300;">
      </div>
    </div>
 </body>
</html>

No comments:

Post a Comment