How to use Google Maps in your own web pages

Source: Internet
Author: User

The easiest way to use Google Maps on your own web page is to:

1. First register the Google API key in http://code.google.com/intl/zh-CN/apis/maps/.

2. Copy the following code to your page:

<script src= "http://ditu.google.com/maps?file=api&amp;v=2&amp;key=abqiaaaacegf_- 3GOIYVTZKJQXPFORQLLSS0KIFCGQZPJPLFE6GSGILJ3XSJGOVPJOISC69P5BCP8PUPWZK9OW&AMP;HL=ZH-CN "type=" Text/javascript " ></script>
<!--Red is the Google API key--
<script type= "Text/javascript" >
Function Initialize ()
{
if (gbrowseriscompatible ())
{
var map = new GMap2 (document.getElementById ("Map_canvas"));
Map.setcenter (New Glatlng (22.556311, 113.936252), 14);
Coordinate values
Map.enablescrollwheelzoom ();//Allow rollers
Map.addmaptype (G_PHYSICAL_MAP);//Add Terrain options
Map.addcontrol (New Glargemapcontrol ());
Map.addcontrol (New Gmaptypecontrol ());

var point = new Glatlng (22.556338, 113.936186);
Map.addoverlay (New Gmarker (point));
}
}
</script>
<div id= "Map_canvas" style= "WIDTH:599PX; height:362px "></div>
<script type= "Text/javascript" >
Initialize ();
</script>

3. Find the coordinates of the location you need from the other operational maps and fill in the
map.setCenter(new GLatLng(x, y)... location (can be found on Google Earth).
As the above code corresponds to the location of Shenzhen Nanshan Science Park north of the Han laser near.

How to use Google Maps in your own web pages

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.