Google Maps API 用法教程_PHP

WBOY
Release: 2016-06-01 12:20:42
Original
1191 people have browsed it

Google

在过去的一年中,在线地图的发展是相当巨大,我们可以看到在线地图的极有价值的信息和其能力。这其中,最有名气的自然是Google Maps。. Google Maps由一个相当强大的开发引擎并也有一个很大的社区提示支持。

Google 允许各种web masters 通过Google Maps API来增加或自定义他们站点特定的地图,你可能从这里取得Google API key 。一个地图 API key只对一个“目录”或域有效。key绑定了你的域名,你要在网站上放地图,需要有对应的key,否则拒绝读取地图数据,在本地测试可以不用key。当然,你可以申请多个API key。

创建一个简单的地图

在你的站点上引入Google Maps 是一件很简单的事情,你只需要加入:

* 引入Google的JavaScript 文件

* 设置JavaScript 一些参数

* 一个你需要显示地图的HTML layer

Google的Javascript文件引入:

1.<script></script>2. charset="UTF-8"
3. src=http://maps.google.com/maps?file=api&v=2&hl=en&oe=utf-8&key=API_KEY
4. type="text/javascript">
5.

注意: 我们可以改变语言,比如说,把“hl=en” 改成中文“hl=zh-CN” 。我们还得要把“API_KEY” 改成我们向Google申请来的那个。

说明: 使用 UTF-8 编码会更好些。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!