Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

Google Maps Types


Google Maps - Basic Map Types

The following map types are supported in Google Maps API:

  • ROADMAP (normal, default 2D map)
  • SATELLITE (photographic map)
  • HYBRID (photographic map + roads and city names)
  • TERRAIN (map with mountains, rivers, etc.)

The map type is specified either within the Map properties object, with the mapTypeId property:

var mapOptions = {
  center:new google.maps.LatLng(51.508742,-0.120850),
  zoom:7,
  mapTypeId: google.maps.MapTypeId.HYBRID
};

Or by calling the map's setMapTypeId() method:

map.setMapTypeId(google.maps.MapTypeId.HYBRID);


Google Maps - 45° Perspective View

The map types SATELLITE and HYBRID support a 45° perspective imagery view for certain locations (only at high zoom levels).

If you zoom into a location with 45° imagery view, the map will automatically alter the perspective view. In addition, the map will add:

  • A compass wheel around the Pan control, allowing you to rotate the image
  • A Rotate control between the Pan and Zoom controls, allowing you to rotate the image 90°
  • A toggle control for displaying the 45° perspective view, under the Satellite control/label

Note: Zooming out from a map with 45° imagery will revert each of these changes, and the original map is displayed.

The following example shows a 45° perspective view of Palazzo Ducale in Venice, Italy:

Example

var mapOptions = {
  center:myCenter,
  zoom:18,
  mapTypeId:google.maps.MapTypeId.HYBRID
};

Google Maps - Disable 45° Perspective View - setTilt(0)

You can disable 45° perspective view by calling setTilt(0) on the Map object:

Example

map.setTilt(0);

Tip: To enable 45° perspective view at a later point, call setTilt(45).