How to create Google Map
To
How to Create Google Map you need use google map API. Here i will show you how to create google map for your website.
To create google map follow below steps;
- Create HTML page
- Load Google map API
- Set google map properties
- Create map container
- Create map object
- Load the map
Example of Roadmap
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js">
</script>
<script>
var myCenter=new google.maps.LatLng(45.434046,12.340284);
function initialize()
{
var mapProp = {
center:myCenter,
zoom:8,
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>
Type of Google Map
There are four types of Google map they are;
- ROADMAP (normal, default 2D map)
- SATELLITE (photographic map)
- HYBRID (photographic map + roads and city names)
- TERRAIN (map with mountains, rivers, etc.)
No comments:
Post a Comment