Monday, March 23, 2015

How to Use Google map in your website

Write down simple code like:

 <!DOCTYPE html>
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
  var mapProp = {
    center:new google.maps.LatLng(12.902568,77.705536),
    zoom:16,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };
  var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>

<body>
<div id="googleMap" style="width:500px;height:380px;"></div>
</body>

</html>


How to get latitude axes to fill value of center:new google.maps.LatLng() in above code:

https://www.google.co.in/maps/place/12%C2%B054%2709.2%22N+77%C2%B042%2719.9%22E/@12.9028498,77.7055504,208m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0

which will give you like below






Use below link to verify whether you are pointing right location

https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse

For reference use :
https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map

No comments:

Post a Comment