Map type of Google Maps interface API (VI)

Source: Internet
Author: User

1. Google maps-Basic map types

The following map types are available in the Google maps API:

    • MapTypeId.ROADMAPTo display the default corridor map view
    • MapTypeId.SATELLITEFor displaying Google earth satellite images
    • MapTypeId.HYBRIDFor simultaneous display of normal and satellite views
    • MapTypeId.TERRAINFor displaying the actual map based on the terrain information.

To modify the type of map you are using with map, you can set the Maptypeid property for it, as follows:

var mapprop = {  Center:New google.maps.LatLng (51.508742,-0.120850),  zoom: 7,  MapTypeId:google.maps.MapTypeId.HYBRID};

Or dynamically modify the Maptypeid:

Map.setmaptypeid (Google.maps.MapTypeId.HYBRID);

2. Google Maps-45° images:

The Google Maps API supports special 45° images for specific locations.

Such high-resolution images provide a perspective view of each of the basic directions (cardinal). For supported map types, these pictures can also provide a higher zoom level.

The existing Google.maps.MapTypeId.SATELLITE and Google.maps.MapTypeId.HYBRID map types support 45° perspective images at high zoom levels, if any. If you zoom in to a location that has such an image, these map types will automatically change their view in the following ways:

    • Any existing panning controls on the map will change to add a compass runner around the existing navigation controls. This compass allows you to change the orientation of any 45° image by dragging the Compass runner and aligning the direction to the most recent support direction that contains the image.
    • A rotation control will show gaps between the existing pan and zoom controls, which can be used to rotate the image around the supporting direction. The rotation control only supports rotation in a clockwise direction.
    • A 45° perspective image centered at the current position will replace the satellite image or mixed image. By default, this type of view is facing north. If you zoom out of the map, the map will re-display the default satellite image or mixed image.
    • The Maptype control enables a submenu toggle control to display a 45° image.

Note: zooming out the map type that displays a 45° image restores all changes and re-constructs the original map type.

The following example shows the 45° view of the Ducal palace in Venice, Italy:

var mapprop = {center:mycenter,zoom: $, MapTypeId:google.maps.MapTypeId.HYBRID};

Examples are as follows:

<HTML><Head><Scriptsrc= "Http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false" ></Script><Script>varMycenter=NewGoogle.maps.LatLng (45.434046,12.340284);functionInitialize () {var Mapprop = {center:mycenter, zoom:MapTypeId:google.maps.MapTypeId.HYBRID};
varMap=NewGoogle.maps.Map (document.getElementById ("GoogleMap"), mapprop);} Google.maps.event.addDomListener (window,'Load', initialize);</Script></Head><Body><DivID= "GoogleMap"style= "width:500px;height:380px;"></Div></Body></HTML>

Tips: Google is constantly adding 45° images to more cities. For the latest information, see the list of 45° images on Google maps.

3. Google maps-Enable and disable 45° images-settilt (0)

You can deactivate the 45° image by calling Settilt (0) on the Map object. To enable a 45° perspective image for a supported map type, call Settilt (45).

Map.settilt (0);

Examples are as follows:

<HTML><Head><Scriptsrc= "Http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false" ></Script><Script>varMycenter=NewGoogle.maps.LatLng (45.434046,12.340284);functionInitialize () {varMapprop={center:mycenter, zoom: -, MapTypeId:google.maps.MapTypeId.HYBRID};varMap=NewGoogle.maps.Map (document.getElementById ("GoogleMap"), Mapprop); Map.settilt (0);} Google.maps.event.addDomListener (window,'Load', initialize);</Script></Head><Body><DivID= "GoogleMap"style= "width:500px;height:380px;"></Div></Body></HTML>            

Map type of Google Maps interface API (VI)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.