Google Maps JS V3 API tutorial (1)--Create a map

Source: Internet
Author: User

Original address

Google Maps JavaScript Official document: https://developers.google.com/maps/documentation/javascript/

Before creating the map, we entered Google developers console to create a key for our development of the map authentication (of course, no key can also be carried out in the next tutorial)

To create a simple map:

<! DOCTYPE html>If you do not have a key, you can remove the code "KEY=YOUR_API_KEY&AMP;CALLBACK=INITMAP" </script> <script src= "https:// Maps.googleapis.com/maps/api/js?key=your_api_key&callback=initmap "Async defer></script> </body >

Using the code above, you can create a map.

If you can't access your Google server because of a network problem, you can change "maps.googleapis.com/maps/api/js" to "Maps.google.cn/maps/api/js" and try

to create a map's constructor prototype: Map (mapdiv:node,opts?:mapoptions)

The center and zoom in the code above are the two attributes in Mapoptions, which are more commonly used:

Draggable:bool type to control whether the map can be dragged

Maptypeid: Hybrid/roadmap/satellite/terrain, four types of maps, you can try the effect on your own

Maptypecontrol:bool type, whether to display controls that can change the map type

Maxzoom: Set map maximum zoom level

Minzoom: set map minimum zoom level

Zoomcontrol:bool type, whether to display a control that can change the size of the map

Google Maps JS V3 API tutorial (1)--Create a map

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.