Skip to content
Related Articles

Related Articles

Improve Article

Google Maps | Types

  • Last Updated : 13 Mar, 2020
Geek Week

To customize the Google map, there are four types of maps provide.

  • ROADMAP: This type of map shows the street view of the specific area. It is the default type map.
  • SATELLITE: This type of map shows the satellite images of the specific area.
  • HYBRID: This type of map shows the major streets of the specific area.
  • TERRAIN: This type of map shows the terrain and vegetation.

Syntax:

var CustomOp= {
   mapTypeId:google.maps.MapTypeId.ROADMAP | SATELLITE | HYBRID | TERRAIN
};

Example 1: ROADMAP




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Google Maps | Types
    </title>
  
    <!-- Add Google map API source -->
    <script src
    </script>
         
    <script>
        function GFG() {
            var CustomOp = {
                center:new google.maps.LatLng(
                        28.502212, 77.405603), 
                zoom:17, 
                mapTypeId:google.maps.MapTypeId.ROADMAP
            };
               
            // Map object
            var map = new google.maps.Map(
                document.getElementById("DivID"),
                CustomOp
            );
        }
    </script>
</head>
  
<!-- Function that execute when page load -->
<body onload = "GFG()">
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
          
        <h3>Google Maps</h3>
          
        <!-- Basic Container -->
        <div id = "DivID" style
            "width:400px; height:300px;">
        </div>
    </center>
</body>
      
</html>

Output:

Example 2: SATELLITE






<!DOCTYPE html>
<html>
  
<head>
    <title>
        Google Maps | Types
    </title>
  
    <!-- Add Google map API source -->
    <script src
    </script>
         
    <script>
        function GFG() {
            var CustomOp = {
                center:new google.maps.LatLng(
                        28.502212, 77.405603), 
                zoom:17, 
                mapTypeId:google.maps.MapTypeId.SATELLITE
            };
               
            // Map object
            var map = new google.maps.Map(
                document.getElementById("DivID"),
                CustomOp
            );
        }
    </script>
</head>
  
<!-- Function that execute when page load -->
<body onload = "GFG()">
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
          
        <h3>Google Maps</h3>
          
        <!-- Basic Container -->
        <div id = "DivID" style
            "width:400px; height:300px;">
        </div>
    </center>
</body>
      
</html>

Output:

Example 3: HYBRID




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Google Maps | Types
    </title>
  
    <!-- Add Google map API source -->
    <script src
    </script>
         
    <script>
        function GFG() {
            var CustomOp = {
                center:new google.maps.LatLng(
                        28.502212, 77.405603), 
                zoom:17, 
                mapTypeId:google.maps.MapTypeId.HYBRID
            };
               
            // Map object
            var map = new google.maps.Map(
                document.getElementById("DivID"),
                CustomOp
            );
        }
    </script>
</head>
  
<!-- Function that execute when page load -->
<body onload = "GFG()">
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
          
        <h3>Google Maps</h3>
          
        <!-- Basic Container -->
        <div id = "DivID" style
            "width:400px; height:300px;">
        </div>
    </center>
</body>
      
</html>

Output:

Example 4: TERRAIN




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Google Maps | Types
    </title>
  
    <!-- Add Google map API source -->
    <script src
    </script>
         
    <script>
        function GFG() {
            var CustomOp = {
                center:new google.maps.LatLng(
                        28.502212, 77.405603), 
                zoom:17, 
                mapTypeId:google.maps.MapTypeId.TERRAIN
            };
               
            // Map object
            var map = new google.maps.Map(
                document.getElementById("DivID"),
                CustomOp
            );
        }
    </script>
</head>
  
<!-- Function that execute when page load -->
<body onload = "GFG()">
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
          
        <h3>Google Maps</h3>
          
        <!-- Basic Container -->
        <div id = "DivID" style
            "width:400px; height:300px;">
        </div>
    </center>
</body>
      
</html>

Output:

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!




My Personal Notes arrow_drop_up
Recommended Articles
Page :