Types of Google Maps


Prev Tutorial Next Tutorial

Types of Google Maps

Here we discuss about types of Google Maps. Every map have its own features and uses. Google Maps provides four types of maps. They are.

  • Roadmap (normal, default 2D map)
  • Satellite (photographic map)
  • Hybrid (photographic map + roads and city names)
  • Terrain (map with mountains, rivers, etc.)

Create Roadmap Google Maps

Syntax

	
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js">
</script>

<script>
function initialize()
{
  var mapProp = {
    center: new google.maps.LatLng(51.508742,-0.120850),
    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:600px;height:300px;"></div>
<br>

</body>
</html>

Output

Create Satellite Google Maps

Syntax

	
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js">
</script>

<script>
function initialize()
{
  var mapProp2 = {
    center: new google.maps.LatLng(51.508742,-0.120850),
    zoom:8,
    mapTypeId: google.maps.MapTypeId.SATELLITE
  };
  var map = new google.maps.Map(document.getElementById("googleMap2"),mapProp2);
}

google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>

<body>
<div id="googleMap2" style="width:600px;height:300px;"></div>
<br>

</body>
</html>

Output

Create Hybrid Google Maps

Syntax

	
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js">
</script>

<script>
function initialize()
{
  var mapProp3 = {
    center: new google.maps.LatLng(51.508742,-0.120850),
    zoom:8,
    mapTypeId: google.maps.MapTypeId.HYBRID
  };
  var map = new google.maps.Map(document.getElementById("googleMap3"),mapProp3);
}

google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>

<body>
<div id="googleMap3" style="width:600px;height:300px;"></div>
<br>

</body>
</html>

Output

Create Terrain Google Maps

Syntax

	
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js">
</script>

<script>
function initialize()
{
  var mapProp4 = {
    center: new google.maps.LatLng(51.508742,-0.120850),
    zoom:8,
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };
  var map = new google.maps.Map(document.getElementById("googleMap4"),mapProp4);
}

google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>

<body>
<div id="googleMap4" style="width:600px;height:300px;"></div>
<br>

</body>
</html>

Output


Prev Tutorial Next Tutorial




Facebook Likes

Advertisements