Nov 20, 2014

Creating A Google Map Using Google Map API v3

Following Example Will Help You To Develop Your Own Google Map Using Given Latitude & Longitude.Before Using Make Sure You have Downloaded The "jquery.gmap3.min.js" Java Script File.



<html>
   <head> 
      <title>Google Map v3</title> 
      <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false& libraries=places"></script>
      <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script>
      <script type="text/javascript" src="jquery.gmap3.min.js"></script>
   </head> 
   <body>
      <div id="map-canvas" style="width:100%;height:500px;"></div>
      <script type="text/javascript">
         var map;
        var lat = 6.929537;//Your Location Latitude
        var lon = 79.866271;//Your Location Longitude
        var str = '[{ "lat" :"' + lat + '","lng" :"' + lon + '"}]';
         str = JSON.parse(str);
       
        jQuery('#map-canvas').gmap3({
            marker: {
               values: str,
               options: {
                icon:'http://maps.google.com/mapfiles/ms/icons/red-dot.png',
                 //icon:new google.maps.MarkerImage("marker.png"),
               }
            },
            map: {
               options: {
                 zoom: 14,
                 scrollwheel: true,//Make It false To Stop Map Zooming By Scroll
                 streetViewControl: true
               },
            },
         });
      </script> 
   </body>
</html>





Below Code Also Can Use Create The Map Using Given Latitude & Longitude.


<html> 
   <head> 
      <title>Google Map v3</title> 
      <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
      <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script>
      <script type="text/javascript" src="jquery.gmap3.min.js"></script>
   </head> 
   <body>
      <div id="map-canvas" style="width:100%;height:500px;"></div>
      <script type="text/javascript">
         var lat = 6.929537;//Your Location Latitude
        var lon = 79.866271;//Your Location Longitude

        jQuery('#map-canvas').gmap3({
           marker:{
              latLng: [lat, lon]
           },
           map:{
              options:{
                 zoom: 14
              }
           }
        });
      </script> 
   </body>
</html>


This Is Simple Example That Shows The Location Using A Marker.If You Want You Can Add Events For The Marker & Shows A Info Window.

Check My Other Articles About Google Maps.

1. Creating A Google Map Using Google Map API v3
2. Show Current Location In A Google Map Using Google Map API v3
3. Getting The Address Of Selected Location In Google Map Using Google Map API v3
4. Getting The Selected Latitude And Longitude From Google Map Using Google Map API v3
5. Google Map With Multiple Markers & Info Windows Using Google Map API v3
6. Getting The Direction Between Two Markers In Google Map Using Google MAP API
7. Getting The Direction Between Two Locations Using Google MAP API
8. Getting The Distance Between Two Markers In Google Map Using Google MAP API
9. Getting The Distance Between Two Locations Using Google MAP API
10. Getting The Nearest Places For A Location In Google Map Using Google MAP API
11. Google Map With InfoBubble
12. Google Maps Creating Polygon And Retrieving Coordinates

No comments:

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...